Detect Leap Years

=MOD(YEAR(A1),4)=0

If A1 is a leap year, the above formula will return TRUE

Actually I was told that the above formula is incorrect by Rick Blaiklock. According to Wikipedia (http://en.wikipedia.org/wiki/Leap_years)

The Gregorian calendar adds an extra day to February, making it 29 days long, in years divisible by 4, excepting years divisible by 100, but including years divisible by 400. So 1996, 2000, and 2400 are leap years but 1800, 1900 and 2100 are not. (The Gregorian calendar seems to be the one in use in most countries but you might want to check just in case)

Wow, I never knew that. Anyway, here is my "improved" formula as a workaround.

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

Here's a shorter one suggested by Jason Morin. Very nice!

=MONTH(DATE(YEAR(A1),2,29))=2



© Copyright andrewsexceltips.net All Rights Reserved.