Count the number of cells between same values

Shade42

New Member
Joined
Jun 8, 2016
Messages
2
Hello,

I need help with a formula than will count number of cells between same values.

This thread http://www.mrexcel.com/forum/excel-questions/795116-count-number-cells-between-values.html has an almost ideal formula for me but I need the numbers range between 0 and 99 instead 0 and 1.

In my example I will count cells between number "5". (attached)

count.jpg


Thanks for your help
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi,

Try this:
AB
11
22
33
44
554
66
77
81
92
103
114
1256
136
141
152
163
174
1856
1956
201

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B2=IF(A2=5,COUNTIF(A$1:A1,"<>"&5)-SUM(B$1:B1),"")

<tbody>
</tbody>

<tbody>
</tbody>

And copy down to your need.
 
Last edited:
Upvote 0
That's it! Thank you very much. Saved me a lot of searching and thinking. Additionally is there a tweak to show 1 instead of 0 (and same logic for all other numbers) when there is the same number after number - 13,16,5,5....
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,005
Members
449,203
Latest member
Daymo66

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