Monday, September 9, 2013

Calculate the difference in Years, Months & Days between two dates

Scenario 01

Assume that you need to calculate the working experience of your employees as at a given date / today

Date as at: 9-Sep-13
EMP No Date Joined   Years Months Days
1 22-Mar-02   11 5 18
2 5-Jan-89   24 8 4
3 16-Dec-96   16 8 24

To do the above calculation use the Excel function  DATEDIF   

Syntax :    =DATEDIF( older date , new date , format )

older date  :  Older date out of the 2 dates to compare
new date    :  Newer date out of the 2 dates to compare

format       :   Should be entered within "  " and as follows

                        "y"  to get years
                        "ym" to get months
                        "md" to get the days

Note:          : DATEDIF function does not exist in Excel Help, but you can safely use it.
        
                      if you use "m" as the format for months, it will give the no of months
                      without subtracting the years,
                     ( eg. 2 years & 3 months will be shown as 27 months )
                     
                      if you use "d" as the format for days, it will give the No. of days between the
                      2 dates which is equal to the number you get by subtracting one date
                      from another

 Given below is the formulas