Count data

bdtran

New Member
Joined
Oct 11, 2018
Messages
33
Hello All,

I'm trying to get a formula to count with sequence number of "0" and "1" from data row #2 . The result should be looked like
in the row #4 and row #5 . If there is an "A", then I just need to copy it to the same row as number/Letter in the front of it.

I appreciate any help that you can provide.
*BDT


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]data[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]A[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]A[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD]0[/TD]
[TD]A[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]count "0"[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]A[/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD]5[/TD]
[TD]A[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]count "1"[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]A[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi,

Try this : (drag as needed)

B4 =IF(B2="A","A",IF(B2=0,COUNTIF($B$2:B2,0),""))
B5 =IF(B2="A","A",IF(B2=1,COUNTIF($B$2:B2,1),""))
 
Upvote 0
Hi,

Your written description and shown sample is a bit unclear for me.

B4 and B5 formulas produces results as I understand your written description.
B7 and B8 formulas produces results as your shown sample.

Formulas copied across:


Book1
ABCDEFGHIJKLMNOPQ
1
2data11A100A1100AA0A0
3
4count "0" A12A34AA5A6
5count "1"12A3A45AAA
6
7count "0" 12A34AA5A6
8count "1"12A345
Sheet333
Cell Formulas
RangeFormula
B4=IFERROR(IF(B2,"",COUNTIF($B2:B2,0)),B2)
B5=IFERROR(IF(B2,COUNTIF($B2:B2,1),""),B2)
B7=IFERROR(IF(B2,"",COUNTIF($B2:B2,0)),IF(OR(A2=0,A7=B2),B2,""))
B8=IFERROR(IF(B2,COUNTIF($B2:B2,1),""),IF(OR(A2,A8=B2),B2,""))
 
Upvote 0
Admiral100,

Thank you for the help.

Just got a chance today to test your formula and it produced the result I need.

*BDT.
 
Upvote 0
Jtakw,

Sorry for the unclear in my description.

I tested your formulas and it produced the result of B7 and B8 is what I am looking for. .

Much appreciated with your help.
*BDT
 
Upvote 0
Admiral100,
Thank you for the help.
Just got a chance today to test your formula and it produced the result I need.
*BDT.

Jtakw,
I tested your formulas and it produced the result of B7 and B8 is what I am looking for.
Much appreciated with your help.
*BDT

You're welcome, but what you said in Post # 4 and # 5 is contradictory, Admiral100's formulas will produce the Same results as my B4 and B5 formulas, and yet you say his formulas and my B7 & B8 formulas is what you're looking for, But they give Different results …?
 
Upvote 0
Jtakw,

You are corrected. His formulas produced the same results as your B4 and B5. Sorry for the unclear post.

I am actually looking for the exactly result from your formulas B7 and B8.

A minor change of Admiral100's formulas below also produced the same result as your B7 & B8.

B4 =IF(AND(B2="A", A2=0),"A",IF(B2=0,COUNTIF($B$2:B2,0),""))
B5 =IF(AND(B2="A", A2=1),"A",IF(B2=1,COUNTIF($B$2:B2,1),""))


Thanks for catching that.
*BDT
 
Upvote 0
Jtakw,
You are corrected. His formulas produced the same results as your B4 and B5. Sorry for the unclear post.
I am actually looking for the exactly result from your formulas B7 and B8.

A minor change of Admiral100's formulas below also produced the same result as your B7 & B8.

B4 =IF(AND(B2="A", A2=0),"A",IF(B2=0,COUNTIF($B$2:B2,0),""))
B5 =IF(AND(B2="A", A2=1),"A",IF(B2=1,COUNTIF($B$2:B2,1),""))

Thanks for catching that.
*BDT

I don't think so, see in Red below:


Book1
ABCDEFGHIJKLMNOPQ
2data11A100A1100AA0A0
3
6
7count "0" my formula 12A34AA5A6
8count "1" my formula12A345
9
10
14Your modified 12A34A5A6
15formulas from Post #712A345
Sheet333
Cell Formulas
RangeFormula
B7=IFERROR(IF(B2,"",COUNTIF($B2:B2,0)),IF(OR(A2=0,A7=B2),B2,""))
B8=IFERROR(IF(B2,COUNTIF($B2:B2,1),""),IF(OR(A2,A8=B2),B2,""))
B14=IF(AND(B2="A", A2=0),"A",IF(B2=0,COUNTIF($B$2:B2,0),""))
B15=IF(AND(B2="A", A2=1),"A",IF(B2=1,COUNTIF($B$2:B2,1),""))
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

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