I this I have the date numbers across the top, I have two rows that will be filled with staff absences for those dates. I need to have a row at the top of the data underneath the dates which is to count the consecutive cells where the number is not 0.

So, if there are 5 consecutive cells that are not zero the count will be 5. However, if the next cell is 0 the count will reset to 0 and then start again when we have a new non zero cell.

In the above image for instance the count on the 10th would say '9', and then when it starts again on the 15th it would say '1' and end with '4' on the 18th.

Any idea how I can achieve this with a formula?

Realistically in the above scenario, while I require the two separate absence lines I will actually need the count to refer to both rows, instead of just row 3. So, each day would be row 3+row 4.