Kamilski81
Kamilski81

Reputation: 15127

How can I count number of populated consecutive fields in excel?

Is there a formula that allows me to calculate number of consecutively populated fields until my first blank field.

For example

Date   Minutes Worked Out  Consecutive Days Worked Out
======================================================
9/8           25               1
9/9           27               2
9/10          30               3
9/11          0                0
9/12          0                0
9/13          22               1
9/14          15               2
9/15          0                0

Notice that my calculation restarts at 1 on 9/13 since the previous day was a 0.

Upvotes: 1

Views: 90

Answers (2)

Ahmed Amin Shahin
Ahmed Amin Shahin

Reputation: 1143

ok just simpley go to coulm E2 and paste this function

=IF(B:B > 0,1+E1,0) then drag all the way to end of cloum E

here is example your excel code ready for what you requested with the above function by the way just make sure you format the column B to be numbers and it has valid numbers in it first ... to do that .. right click on column B and select Cell properties from category Tab select numbers and click on .

here is a link to download your file i have done the same fourmala its working for me .. and the function is placed on E2 and the uploaded excel . good luck

click here to download

Upvotes: 0

learnAsWeGo
learnAsWeGo

Reputation: 2282

This should do the trick:

=IF(B2>0,SUM(C1)+1,0)

.......

=IF(B18>0,SUM(C17)+1,0)

enter image description here

enter image description here

Upvotes: 1

Related Questions