Counting Consecutive Repeated Values...

nicksonic

New Member
Joined
Oct 17, 2007
Messages
41
Hi, i've trawled through the posts on the board and can't find an answer to the problem i'm trying to address.

If i have a row of numeric data, what formula can i use to count the number of consecutive zeroes in the row? It sounds simple, hopefully it is :)

Thanks for your help,

Nick
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Do you mean something like this?:
Excel Workbook
AB
1NumberConsecutive zeros
2
310
430
550
601
702
803
904
1005
1150
1260
1340
1401
1502
1603
Sheet1


Formula is copied down the column.
 
Upvote 0
Thanks for the reply. That's close, but the data goes from left to right, i.e. a1 to j1 for example, so the formula would go in k1...

[Nick]
 
Upvote 0
Are you just looking for one formula which counts the largest number of consecutive zeros that occur in the row?
 
Upvote 0
hi lewiy. yes, initially, although in an ideal world i'd like a formula that counts if the number of consecutive zeroes is 4 or not as well as both pieces of info would be useful.

Thanks,

Nick
 
Upvote 0
Assuming you don't have blanks in the range A1:J1 try this formula

=MAX(FREQUENCY(IF(A1:J1=0,COLUMN(A1:J1)),IF(A1:J1<>0,COLUMN(A1:J1))))

needs to be confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
Something more like this then?
Excel Workbook
ABCDEFGHIJK
1Number1000010123
2Consecutive Zeros123401000
3
4Max Consecutive zeros4
5Are there four?TRUE
Sheet1
 
Upvote 0
Success! Thanks Barry, your formula worked perfectly - i didn't say that my non-positive data was a range of values and the formula didn't seem to like this, so i changed these values to 1's and it worked.

Thanks very much for your help :)

[Nick]
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,497
Members
448,967
Latest member
visheshkotha

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