I don't think your formula works, between April 30, 2020 and April 30, 2024 there is only one leap year on Feb 29, 2024 however your formula calculates two
You're right! thanks for that. 😅😅 my formula only works if a leap year occurs in the year you're checking. I've added a few logical conditions to solve your issue: =SUMPRODUCT( (MOD(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 4) = 0) * (MOD(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 100) 0) + (MOD(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 400) = 0) * (DATE(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 2, 29) >= A2) * (DATE(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 2, 29)
Wo, didn't realise next year is a leap year - thanks for the heads up!
And another in 2028 😁
Very interesting
Clever!
Thanks for this 😁
Can you check to see how many days are in a year?
Yep you could use: =IF(DATE(YEAR(A2),12,31)-DATE(YEAR(A2),1,1)+1=366,"Leap","")
I don't think your formula works, between April 30, 2020 and April 30, 2024 there is only one leap year on Feb 29, 2024 however your formula calculates two
You're right! thanks for that. 😅😅 my formula only works if a leap year occurs in the year you're checking. I've added a few logical conditions to solve your issue:
=SUMPRODUCT(
(MOD(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 4) = 0) *
(MOD(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 100) 0) +
(MOD(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 400) = 0) *
(DATE(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 2, 29) >= A2) *
(DATE(ROW(INDIRECT(YEAR(A2) & ":" & YEAR(B2))), 2, 29)