Determining If a Year is a Leap Year

by Allen Wyatt
(last updated April 23, 2020)


Bob wonders if there is an easy way to determine if the year of a particular date is a leap year, for purposes of calculating interest and number of compounding days.

We all know that if a year is divisible by 4, then it is a leap year, right? Well, actually, that is wrong. So, you can't simply divide a year number by 4, as in the following, to determine if it is a leap year:

=IF(MOD(YEAR(A1), 4) = 0, "Leap", "Regular")

The formula will work for all dates within this century (years 2000 through 2099), but it won't work reliably outside that range. The reason is because "divisible by 4" is not the only test for a leap year. If the year is a century year (divisible by 100), then it is a leap year only if it is divisible by 400. So the year 2000 is a leap year, but the year 2100 is not.

If you want a bulletproof way to determine if a date occurs within a leap year, then your formula needs to be more complex:


Note that this is a single formula; it is shown here on two lines so it fits fully on the screen. The formula tests all three conditions that are necessary to determine if a date falls within a leap year.

Of course, a different approach is to simply figure out if a given year has a February 29 within it. There are any number of formulas that could be used to accomplish this task:

=IF(DAY(EOMONTH("1Jan"&YEAR(A1),1))=29, "Leap", "Regular")
=IF(MONTH(DATE(YEAR(A1),2,29))=2, "Leap", "Regular")
=IF(DAY(DATE(YEAR(A1),2,29))=29, "Leap", "Regular")
=IF(DAY(DATE(YEAR(A1),3,0))=29, "Leap", "Regular")

Any of the methods described so far work fine for any date supported by Excel, with one exception. Those that use the DATE function (the last three shown above) won't work if the date in cell A1 is in the year 1900. Those will always return that 1900 is a leap year, even though it is not. (Interestingly enough, the EOMONTH function doesn't exhibit the same problem as the DATE function does in this regard.)

If you need to work with dates that are before those supported by Excel (before January 1, 1900), then you'll need to work with years directly instead of pulling the year from an Excel date. The variation on the three-test formula will work just fine, if cell A1 contains only a year:


You could also create a user-defined function that would test the date. This approach will work just fine regardless of whether the cell contains a date value or a text value for a date. (If you enter an unsupported date value into a cell—such as 1/1/1896—then Excel treats the entry as a text value rather than trying to parse it as a date.) The following example works correctly with all dates supported by VBA, which is in the range of the year 100 through the year 9999:

Function IsLeap1(c As Range) As Boolean
    YearNo = Year(c.Value)
    If YearNo Mod 100 = 0 Then
       IsLeap1 = ((YearNo \ 100) Mod 4 = 0)
       IsLeap1 = (YearNo Mod 4 = 0)
    End If
End Function

To use the function in your worksheet you would enter a formula such as this:

=IF(IsLeap1(A1),"Leap", "Regular")

The following single-line macro works by using the trick of figuring out if there is a February 29 in the year in question:

Function IsLeap2(c As Range)
    IsLeap2 = IsDate("2/29/" & Year(c.Value))
End Function

The macro is referenced the same way in your worksheet as the previous macro:

=IF(IsLeap2(A1),"Leap", "Regular")

If you need more creative ways to determine if a date is in a leap year, check out this article:


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9978) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Counting Records Matching Multiple Criteria

Excel provides worksheet functions that make it easy to count things. What if you want to count records that match more ...

Discover More

Adjusting the Width of Characters

Need to adjust how your characters look horizontally? Word provides an easy way you can scale the horizontal appearance ...

Discover More

Relative References within Named Ranges

Excel is usually more flexible in what you can reference in formulas than is immediately apparent. This tip examines some ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Finding the Dates for Minimums and Maximums

If you use Excel to maintain a collection of data, you may need to find information in one column based on information in ...

Discover More

Calculating a Group Retirement Date

Calculating a retirement date can be as simple as doing some date math to see when a person reaches a certain age. ...

Discover More

Calculating Averages by Date

When you have a huge amount of daily data to analyze, you may want to calculate an average of values for any given date ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

2018-01-31 10:14:24

Willy Vanhaelen

To whom it may concern:

For all years in the Gregorian calendar, including those before 1900 this formula is the shortest to determine a leap year (A1 contains only the year):


Here some examples of how it works:
For 1900:
MOD(1900,4) -> 0
(MOD(1900,100)=0) -> TRUE=1
(MOD(1900,400)=0) -> FALSE=0
0+1-0=1 (TRUE) -> regular

For 2000:
MO0(2000,4) -> 0
(MOD(2000,100)=0) -> TRUE=1
(MOD(2000,400)=0) -> TRUE=1
0+1-1=0 (FALSE) -> leap

For 2018:
MO0(2018,4) -> 2
(MOD(2018,100)=0) -> FALSE=0
(MOD(2018,400)=0) -> FALSE=0
2+0-0=2 (TRUE) -> regular

2015-05-18 12:04:11

Michael (Micky) Avidan

@Tony Davis.
I was referring to the few last(!) COMMENTS (not in Allan's tip) whereas none of the suggestions handles the year 1900.
I, usually, don't look for "excuses" (especially not from MS).
As far as I recall, my suggested formula was the shortest among Allan's formulas that work.
Am I wrong at that point ? (Length of formula).
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator

2015-05-18 03:17:06

Tony Davis

The second formula works for all years incl. 1900 wheras the other formulas are only wrong for 1900 and Microsoft explain the reasoning for that.

The article also clearly indicates that most of these formula don't work for 1900 and clearly states the "bulletproof" formula that does work for 1900.

2015-05-17 08:09:11

Michael (Micky) Avidan

With all due respect - none of the formulas, in the suggest comments handles correctly the year 1900.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)

2015-05-16 15:05:03

Bruce Osterberg

All this works if the year is after 1582, the year the Gregorian Calendar when put into use. Before that the Julian Calender was in use and is much simpler.

2015-05-16 11:49:52

Ron Fiorito

All the formulas provided thus far (including mine in a previous post) will tell Bob if the year is a leap year or not. However, Bob still needs to interpret the results in his other formulas to calculate interest and number of compounding days. IF the end result is simply to know how many days there are in the year (365 or 366), then the following formula gets right to the point:


2015-05-16 11:18:44

John Hamm

Assume the year is a leap year, and create a text string such as "2/29/2015". Use the DATEVALUE function to determine if it is a valid date:


2015-05-16 11:09:55

Ron Fiorito

This formula takes a completely different approach. It uses the fact that the 60th day of the year is either in February if the year is a leap year, or March if it is not.


This formula returns a zero if it’s a leap year, or 1 if it is not. Shorter and simpler.

If you wanted a TRUE/FALSE result, just add =0 to the end like this:


This will return TRUE if it’s a leap year, or FALSE if it is not.

These work for all supported dates except for the buggy year 1900.


2015-05-16 10:56:18

Richard Zawadzki

The Soviet Union observed February 30 in 1930 and 1931. Sweden had Feb 30 in 1712.

If Bob was counting the number of days for interest purposes, and was working on historical dates, he'd better know the relevant country and the relevant calendar (China removed 12 days 1911/1912, Turkey removed 13 days in 1926/1927, Japan removed 12 days in 1872/1873, US Canada and UK removed 11 days in 1752)


2015-05-16 10:39:11

Richard Zawadzki

You can only have Feb 29th in a Leap Year. So, in terms of Excel checking whether a date is in a Leap Year or not, you just need to check whether Excel allows 29th Feb for that particular year. If it does allow it, then it's a Leap Year as far as Excel is concerned. The formula DATE(Year(A1), 2, 29) will display as 01-March if that year is NOT a Leap Year.
So, you can use this formula:

Richard Z

2015-05-16 06:47:04

Michael (Micky) Avidan

If the first THREE formulas would have been a problem for only a single year problem (1900) I would, probably, not commented BUT, although most of us will be in a better environment, the same "problem" follows the year 2100, 2200, 2300 and so on...
Therefore this must be taken into consideration – so, my contribution, to Bob's original question, was:
(While cell A1 holds only the year)
If pone needs to check over a full date then:
*** Returning TRUE for a Leap year and FALSE for a Regular year.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.