count formula 3s&1s

andrichara

New Member
Joined
Jan 13, 2019
Messages
14
hi to all, i have an arrey formula at H1 which counts 3s and 1s only from a row G:G(random generator of 3s,2s,1s) and in case of number 2 apeared should count 0 and then continue counting 3s and 1s.
the formula is working until 2 apears ,it shows 0zero but it stops, imean the zero is permanent,i want the formula to continue counting.


=IF(COUNTIFS(G:G,"<>1",G:G,"<>3",G:G,"<>")<>0,0,IFERROR(INT(MATCH(0,INDEX(--($G2:INDEX(G:G,COUNT(G:G))<>$G1:INDEX(G:G,COUNT(G:G)-1)),N(IF(1,COUNT(G:G)-ROW(INDIRECT("1:"&COUNT(G:G)-1))))),)/2),INT(COUNT(G:G)/2)))



i need your help please!!thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Are you just counting 1s and 3s because that is a lot of formula for just that.


Excel 2010
GH
133
22
31
43
Sheet1
Cell Formulas
RangeFormula
H1=SUM(COUNTIF(G:G,{1,3}))
 
Last edited:
Upvote 0
If you mean a running count, then try this:

=SUM(COUNTIF($G$1:G1,{1,3}))*(G1<>2)
Copy down.


Excel 2010
GH
131
220
312
433
Sheet1
Cell Formulas
RangeFormula
H1=SUM(COUNTIF($G$1:G1,{1,3}))*(G1<>2)
H2=SUM(COUNTIF($G$1:G2,{1,3}))*(G2<>2)
H3=SUM(COUNTIF($G$1:G3,{1,3}))*(G3<>2)
H4=SUM(COUNTIF($G$1:G4,{1,3}))*(G4<>2)
 
Last edited:
Upvote 0
If you mean a running count, then try this:

=SUM(COUNTIF($G$1:G1,{1,3}))*(G1<>2)
Copy down.

Excel 2010
GH

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H1[/TH]
[TD="align: left"]=SUM(COUNTIF($G$1:G1,{1,3}))*(G1<>2)[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H2[/TH]
[TD="align: left"]=SUM(COUNTIF($G$1:G2,{1,3}))*(G2<>2)[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H3[/TH]
[TD="align: left"]=SUM(COUNTIF($G$1:G3,{1,3}))*(G3<>2)[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H4[/TH]
[TD="align: left"]=SUM(COUNTIF($G$1:G4,{1,3}))*(G4<>2)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
thank you so much

the formula is counting an event ,like if 31 count1 if then 313count 1 if then3131 count 2 and so on,what i need is if any other number apeared except 3 and 1 to count 0 and if then continue if 3 1 apeared
 
Upvote 0
Cross posted https://www.excelforum.com/excel-general/1262572-count-if-formula.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top