How to find largest sequence of a given number in excel?

后端 未结 2 441
暖寄归人
暖寄归人 2020-12-19 22:06

I have a column of zeros and ones

1
0
0
0
1
1

I want to find out the largest sequence of zeros I have in my column AND how many times it ap

2条回答
  •  隐瞒了意图╮
    2020-12-19 22:25

    With data in column A, in B1 enter:

    =IF(A1=1,0,1)
    

    and in B2 enter:

    =IF(A2=0,1+B1,0)
    

    and copy down:

    enter image description here

    the longest sequence is:

    =MAX(B:B)
    

    and the number of times it occurs is:

    =COUNTIF(B:B,D1)
    

    if the MAX() formula is in D1

提交回复
热议问题