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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
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
131
220
312
433

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
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)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
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,215,474
Messages
6,125,024
Members
449,204
Latest member
LKN2GO

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