How to check if a year is a leap year in Excel
Formula (Excel and Google Sheets)
=IF(MONTH(DATE(A2,2,29))=2,"Leap year","Common year")Ask DATE for February 29: =IF(MONTH(DATE(A2,2,29))=2,"Leap year","Common year"). In a common year it rolls over to March.
- Result on the example
- one result per row in
B2, filled down toB7 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in B2, filled down to B7. Change any input and the result updates, or edit the formula to experiment.
How it works
DATE accepts February 29 for any year, but in a common year it rolls over to March 1. If the month is still 2, the date exists and the year is a leap year. The calendar rules come for free: 2100 is not a leap year, 2000 is.
=IF(MONTH(DATE(A2,2,29))=2,"Leap year","Common year")Result"Leap year"
A22024The value in A2.
DATE(A2,2,29)2/29/2024 (45351)DATE: Builds a date from parts.- year
A22024 - month
2 - day
29
- year
MONTH(DATE(A2,2,29))2MONTH: Month of a date, 1–12.- serial_number
DATE(A2,2,29)2/29/2024 (45351)
- serial_number
MONTH(DATE(A2,2,29))=2TRUEThe = operator tests whether the two sides are equal.
IF(MONTH(DATE(A2,2,29))=2,"Leap year","Common year")"Leap year"IF: Returns one value if a test is true, another if false.- logical_test
MONTH(DATE(A2,2,29))=2TRUE - value_if_true
"Leap year" - value_if_false
"Common year"not used
- logical_test
In Google Sheets
The same formula works in Google Sheets: =IF(MONTH(DATE(A2,2,29))=2,"Leap year","Common year"). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =IF(DAY(DATE(A2,3,0))=29,"Leap year","Common year") | Leap year, Common year, Common year… | Day 0 of March is the last day of February. |
| =IF(OR(MOD(A2,400)=0,AND(MOD(A2,4)=0,MOD(A2,100)<>0)),"Leap year","Common year") | Leap year, Common year, Common year… | The rule written out: every 4 years, except century years not divisible by 400. |
Common mistakes
MOD(A2,4)=0alone calls 2100 a leap year. Century years are leap years only when divisible by 400.- Excel treats 1900 as a leap year for compatibility with Lotus 1-2-3, so the DATE test is wrong for 1900. Use the MOD rule for years before 1901.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Check if a year is a leap year
B2, show "Leap year" or "Common year" for the year in A2, and fill down to B7.Questions
How do I check the year of a date instead of a year number?
Wrap it in YEAR: =MONTH(DATE(YEAR(A2),2,29))=2.
How many days are in the year?
=IF(MONTH(DATE(A2,2,29))=2,366,365).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.