How to check if a year is a leap year
✓ Verified in LibreOffice 25.8.7.3One formula instead of remembering the divisible-by-4-except-100-except-400 rule.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =MONTH(DATE(A2,2,29))=2 | A2 = the year as a number. TRUE in leap years. |
| Google Sheets | =MONTH(DATE(A2,2,29))=2 | Identical. |
| LibreOffice Calc | =MONTH(DATE(A2,2,29))=2 | Identical. |
How it works
Instead of encoding the century rules, let the date engine do it: DATE(year,2,29) stays in February only when Feb 29 exists — in a common year it rolls over to March 1 and MONTH returns 3. 2024 passes (TRUE); 2026 wouldn't; and the century rule comes free (1900: FALSE, 2000: TRUE). Days in a year is the sibling one-liner: =DATE(A2+1,1,1)-DATE(A2,1,1) gives 365 or 366.
Verified, not just documented
We ran =MONTH(DATE(A2,2,29))=2 in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned True — exactly the expected result. Every formula here is confirmed by actually executing it.