View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\)[_793_] Rick Rothstein \(MVP - VB\)[_793_] is offline
external usenet poster
 
Posts: 1
Default Determining a leap year

And, generalizing this, here is the formula that returns TRUE if a given
year is a leap year...

=ISNUMBER(--(A1&"-02-29"))

where A1 contains a year value (2000, 2007, 2008, etc.). If A1 contains a
date, then that date is in a leap year if this formula returns TRUE...

=ISNUMBER(--(YEAR(A1)&"-02-29"))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Actually, I take that back... at one function call less, I think this one
is more efficient...

=365+ISNUMBER(--(YEAR(TODAY())&"-02-29"))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
But won't something like:

=365+(MONTH(DATE(YEAR(TODAY()),2,28)+1)=2)

do just as well?


I came up with a similar idea, just expressed differently...

=365+ISNUMBER(MONTH(--(YEAR(TODAY())&"-02-29")))

Same number of function calls, but yours avoids the concatenation, so I'm
guessing yours is more efficient.

Rick