In your example:
C2: =COUNTA(B2:B366) = 365
D2: =COUNTIF(B2:B366,0) = 317
E2: =365-COUNTIF(B2:B366,0) = 48
F2: =D2+E2 = 365
If you drag these formulae down, they will give a 365 "rolling" total.
Code to fill the range D2:D366
![]()
With Range("D2:D366") .FormulaR1C1 = _ "=COUNTIF(RC[-2]:R[364]C[-2],0)" .Value = .Value End With
And column E:
![]()
With Range("E2:E366") .FormulaR1C1 = _ "=365-COUNTIF(RC[-3]:R[364]C[-3],0)" .Value = .Value End With
Regards, TMS
Bookmarks