How to subtract
dates in Microsoft Excel.?
I am using Microsoft Execl 2007 and want to calculate the total years, months and days a person worked from his date
of joining till his date of leaving.
Example:
Date of Joining: mm-dd-yyyy
Date of Leaving:- mm-dd-yyyy
I want the output in the result cell to be 'X years, Y Months and Z days'.
You can subtract two dates in Microsoft Excel using the DATEDIF()
function:
DATEDIF(DATE1,DATE2,Unit)
DATE1 = Start Date
DATE2 = End Date
Unit to be enclosed in quotes:
"m" - complete calendar months between the 2 dates
"d" - number of days between the 2 dates
"y" = complete number of years bewteen the 2 dates
"ym" = complete calendar months between the 2 dates assuming the
months are in the same year
"yd" = complete calendar days between the 2 dates assuming they are in
the same year
"md" = complete calendar days between the dates assuming they were in
the same month and same year.
You can combine the 'datedif()' function andt the 'today()' function to
calculate the age orf a person.
Note: Use this function with caution since it sometimes gives erratic
results particularly in the "md" calculations.
Watch the video to see learn how the MS Excel solution is implemented: