Leap Year

S

scrabtree23

I have a formula that calculates an employee's anniversary
date. It looks like this:

=IF(TODAY()>=M34,364,0)

Another formula takes the result of this cell and adds it
to the employee's current anniversary date.

However, I have not taken into account for a leap year???
 
B

Bob Phillips

Not clear why you are using 364 not 365, but assuming you want 365 for leap
years, try

=IF(TODAY()>=M34,IF(MONTH(DATE(YEAR(TODAY()),2,29))=2,365,364),0)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
G

greg prost

=int((DATEDIF(A1,NOW(),"d"))/365.25)

This is currently used for a persons age. Their birth day
goes in A1,the (DATEDIF(A1,NOW(),"d") function finds out
how many days old they are. The rest assumes that if
there is one leap day every four years then that's 0.25
per year, hence "/365.25".

this works well enogh for our needs as the int function
sorts most problems out,

hth
greg
 
H

Harald Staff

Hi

Here's a "next birthday" formula with birth date in cell A1. Pretty long,
remove all line breaks that the posting may create:

=DATE(YEAR(TODAY())+((MONTH(A1)<MONTH(TODAY()))+(MONTH(A1)=MONTH(TODAY()))*(
DAY(A1)<DAY(TODAY()))),MONTH(A1),DAY(A1))
 
Top