How to check if a year is a leap year
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)One formula instead of remembering the divisible-by-4-except-100-except-400 rule.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned True for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
MONTH · DATE — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to get the quarter-end date for any date
- How to count dates within a range
- How to get the day number of the year (1-365)
- How to get the quarter from a date
- How to create a quarter-and-year label like "Q3 2026"