LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 318
Default formula to caluclate the # of years and months between two dates

I think the calculation of the number of Years, Months and Days is not as
straight forward as one of the posts has implied. If someone joins on 12/1/05
then
=Month(Now())-Month("12/1/05") will give -1
Similarly negative numbers will be calculated in the day part of the
calculation.

I would suggest splitting up the calculation into three steps

If A2 has the join date then put formula for Year in B2. This will be
=IF(AND(YEAR(NOW())YEAR(A2),MONTH(NOW())MONTH(A2 ),DAY(NOW()DAY(A2))),DATEDIF($A$2,NOW(),"y"),0)

Put formula for calculating Months in C2. This will be
=DATEDIF(DATE(YEAR(A2)+B2,MONTH(A2),DAY(A2)),NOW() ,"m")

Put formula for calculating Days in D2 as follows
=DATEDIF(DATE(YEAR(A2)+B2,MONTH(A2)+C2,DAY(A2)),NO W(),"d")

There is probably a simpler approach. I would definately like to hear about
it.

"Christyepd" wrote:

I am setting up the employees lenths of service from the date hired until
present date.

 
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
FORMULA FOR CALCULATING YEARS, DAYS, & MONTHS BETWEEN SEVERAL DATE Sam Excel Discussion (Misc queries) 3 June 28th 06 10:34 PM
Dates - Months & Years Rick Excel Worksheet Functions 5 November 23rd 05 04:11 PM
Formula that will represent years & months worked Pam Excel Discussion (Misc queries) 5 August 29th 05 11:20 PM
how to calculate years, months by using one formula srinivasa rao Charts and Charting in Excel 2 April 15th 05 08:28 AM
How do I display months and years between two dates JSmith Excel Discussion (Misc queries) 1 November 30th 04 04:41 PM


All times are GMT +1. The time now is 12:33 AM.

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

About Us

"It's about Microsoft Excel"