I have a list of numbers (ex. 5, 7, 10, 11, etc.) and 0s in excel rows from D2:BH2
, and I want to calculate the longest streak of 0s in each row (with 2 conditions).
The first condition is to ignore streaks that start the row with 0
Ex. (0 0 0 1 5 6 0 0 1
) -> this would have a longest streak of 2
instead of 3
due to the first condition
Ex. ('1 0 0 0 1 5 6 0 0 1') -> this would have a longest streak of '3'
The second condition is to ignore streaks that end the row with 0
Ex. (0 1 5 6 0 0 1 0 0 0 0
) -> this would have a longest streak of 2
instead of 4
due to the second condition.
Ex. (' 0 1 5 6 0 0 1 0 0 0 0 1') -> this would have a longest streak of '4'
Is there a simple way of calculating the streak of 0s based on these two conditions for each row (in one cell formula)?
Currently I'm using a formula:
=MAX(FREQUENCY(IF(D2:BH2=0,COLUMN(D2:BH2)),IF(D2:BH2=0,0,COLUMN(D2:BH2)
This calculates the longest streak; however, does not take into account the two conditions.