#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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???
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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???



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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???



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Leap Year BadBoy Excel Worksheet Functions 7 April 29th 09 11:49 PM
Leap Year Jet Excel Discussion (Misc queries) 3 March 20th 08 04:17 PM
leap year p-nut Excel Discussion (Misc queries) 5 January 10th 08 05:34 AM
Leap Year Ralph Page Charts and Charting in Excel 3 November 5th 07 01:57 AM
How to determine if year is a leap year Wanda Excel Worksheet Functions 7 September 17th 07 07:48 AM


All times are GMT +1. The time now is 06:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"