Excel: Leap Year Formula

Trying to figure out if a date occurs during a leap year in Microsoft Excel? It's February 29th, and I have decided to post a formula that will help you to quickly determine this for any given date.

If cell A1 contains the year alone (e.g. '2012'), then the following formula will return 'TRUE' if it is a leap year (and 'FALSE' if it isn't):

=IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)<>0)),TRUE,FALSE)

If cell A1 contains an entire date (e.g. '2/29/2012'), then you will want to adjust your formula to use only the year portion of the date:

=IF(OR(MOD(YEAR(A1),400)=0,AND(MOD(YEAR(A1),4)=0,MOD(YEAR(A1),100)<>0)),TRUE,FALSE)

0 comments:

Post a Comment