ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Leap Year (https://www.excelbanter.com/excel-programming/284759-leap-year.html)

scrabtree23[_2_]

Leap Year
 
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???

Bob Phillips[_6_]

Leap Year
 
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)

"scrabtree23" wrote in message
...
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???




Greg Prost

Leap Year
 
=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

Harald Staff

Leap Year
 
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()))+(M ONTH(A1)=MONTH(TODAY()))*(
DAY(A1)<DAY(TODAY()))),MONTH(A1),DAY(A1))

--
HTH. Best wishes Harald
Followup to newsgroup only please

"scrabtree23" skrev i melding
...
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???





All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com