.....D        E
5    1        1 
6    1        2
7    1        3
8    1        4
9    1        5
10   1        6
11   1        7
etc down to 31
If D5 D6 and D7 are left blank i would like this to happen which it does with this formula
=IF(ISBLANK(D6),0,E5+1)

.....D        E
5             0 
6             0
7             0
8    1        1
9    1        2
10   1        3
11   1        4
etc down to 31
If D5 D6 D7 and D10 has nothing in it E10 gets left blank but when d11 has something in it E11 becomes 4 counting the blank cell in between.

example 1
.....D        E
5             0 
6             0
7             0
8    1        1
9    1        2
10            3
11   1        4
etc down to 31
example 2
.....D        E
5    1        1
6             2
7             3
8    1        4
9    1        5
10            6
11   1        7
etc down to 31
example 3
.....D        E
5             0
6             0
7    1        1
8             2
9    1        3
10            4
11   1        5
etc down to 31
the counting starts from the first 1 in the E column

Sorry about the confusion.
Many Thanks