Count max consecutive number 0 in each column

Hi!

Thank you again for help that time ago. How I can get from this formula all these numbers of series of consecutive "0" from which this "MAX" had taken in formula for which I asked before?
For example if there is column 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1
I would like to get result 1;2;3;5
Thank you in advance!

What is the range exactly?
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Last edited:
Upvote 0
In vertical range A2:A13214

Row\Col
A​
B​
C​
1​
4​
2​
0​
3​
1​
1​
4​
0​
2​
5​
0​
3​
6​
1​
5​
7​
0​
8​
0​
9​
0​
10​
1​
11​
0​
12​
0​
13​
0​
14​
0​
15​
0​
16​
1​

In C1 control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(ISNUMBER($A$2:$A$17),IF($A$2:$A$17=0,ROW($A$2:$A$17))),
    IF(ISNUMBER(1/$A$2:$A$17),ROW($A$2:$A$17))),1))
In C3, control+shif+enter and copy down:
Rich (BB code):
=IF(ROWS($C$3:C3)<=$C$1,SMALL(FREQUENCY(IF(ISNUMBER($A$2:$A$17),IF($A$2:$A$17=0,ROW($A$2:$A$17))),
    IF(ISNUMBER(1/$A$2:$A$17),ROW($A$2:$A$17))),ROWS($C$3:C3)+1),"")
 
Upvote 0
Thank you for your time, but something doesnt work. Can you take a look on my example? https://www.dropbox.com/s/r26umk1fjnpqfvt/test.xlsx?dl=0
It returns 0 in C3

I think I know where/why the trouble occurs...

Row\Col
A​
B​
C​
1​
data
count of consecutive 0's
2​
0​
4​
3​
1​
size list of consecutive 0's
4​
1​
1​
5​
0​
1​
6​
1​
3​
7​
0​
5​
8​
0​
9​
0​
10​
1​
11​
0​
12​
0​
13​
0​
14​
0​
15​
0​
16​
1​
17​

Let A2:A17 of Sheet1 house the data.

Let's define (1) CONSEC in Formulas | Name Manager as referring to:
Rich (BB code):
=FREQUENCY(IF(ISNUMBER(Sheet1!$A$2:$A$17),IF(Sheet1!$A$2:$A$17=0,
   ROW(Sheet1!$A$2:$A$17))),IF(ISNUMBER(1/Sheet1!$A$2:$A$17),ROW(Sheet1!$A$2:$A$17)))

and (2) IVEC as referring to:
Rich (BB code):
=ROW(INDIRECT("1:"&SUM(ISNUMBER(CONSEC)+0)))
The foregoing definitions are really needed for reasons of efficiency.

In C2 control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(CONSEC,1))<strike></strike>

In C4 control+shift+enter and copy down:
Rich (BB code):
=IF(ROWS($C$4:C4)<=$C$2,INDEX(CONSEC,SMALL(IF(CONSEC,IVEC),ROWS($C$4:C4))),"")

Note. A huge range may yield a lots of 1's, 2's, etc. Instead of listing such one by one, we could create a table showing of frequencies of didtinct chunk sizes.
 
Upvote 0
Thank you for reviewing.
Now there is no result in C4 even if leave only 17 rows - https://www.dropbox.com/s/9mq8tk85z245usx/1col.xlsx?dl=0

And it`s great idea about creating a table. That`s the thing I really need the most and was thinking about making one after getting these results, so it will be great if it could be get with some formula.

Try to rebuild the set up I described. Do not forget required definitions.
 
Upvote 0
Thank you for correcting my inattention mistake. And much bigger thanks for the formula. I really appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,984
Members
449,058
Latest member
oculus

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