If you have the numbers 1 to 8760 (number of hours in a normal year) in column A then you could use the following but your data would have to start in row 2 to allow the lookup of the number in the previous row. This will just increment the number by 1 every time it reaches 24 hours.
=MAX(IF(A2/24=INT(A2/24),D1+1,D1),1)
If you do not have the numbers in the cells then I would use the following which will use the row number as the 1 to 8760. This will just increment the number by 1 every time it reaches 24 hours.
MAX(IF(row(a2)/24=INT(row(a2)/24),D1+1,D1),1)
If you have the date or time in the sheet it would be an easier formula. Let me know either way
Bookmarks