Excel Count Formula

aqeelnokia99

Board Regular
Joined
Dec 23, 2018
Messages
145
Office Version
  1. 2013
Platform
  1. Windows
Hi All i want to count every number 2 as 1,2,3,4,5....
QtyResult I want
2​
1​
2​
1​
1​
2​
2​
2​
2​
2​
3​
2​
3​
2​
4​
2​
4​
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Please explain how you get "Result I want". I have no idea how you got those numbers.
 
Upvote 0
If I understand you correctly, assuming your data begins in cell A1, enter this formula on row 1 and copy down for all rows:
Excel Formula:
=IF(A1=2,ROUNDUP(COUNTIF(A$1:A1,2)/2,0),"")
this seems to return the exact expected results you showed in your original post.
 
Upvote 0
Solution
Maybe
++Fluff.xlsm
AB
1QtyResult I want
221
321
41 
522
622
7 
8 
923
1023
1124
1224
13
Sheet5
Cell Formulas
RangeFormula
B2:B12B2=IF(A2=2,INT((COUNTIFS(A$2:A2,2)-1)/2)+1,"")
 
Upvote 0
its working Thanks You very very much Friend
If I understand you correctly, assuming your data begins in cell A1, enter this formula on row 1 and copy down for all rows:
Excel Formula:
=IF(A1=2,ROUNDUP(COUNTIF(A$1:A1,2)/2,0),"")
this seems to return the exact expected results you showed in your original post.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Could one of you explain what the original question was? I am impressed with your solutions but I still don't understand what you solved.
 
Upvote 0
It appears to me that they want to count the couplets of "2".
So, the first two "2"s return 1, the second two "2"s return 2, etc.

I gleaned that more from the example that the wording of the question (which I found a bit confusing too).
Admittedly, it was an educated "guess", but it appeared I guessed right!
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,633
Members
452,661
Latest member
Nonhle

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