Microsoft Excel Hints and Tips

Question
I have two dates and would like to calculate the number of years, months and days between them. For example, if my dates are 13 May 2002 and 28 March 2006 - then the result should be 3 years, 10 months, and 15 days. Is there an Excel function to do this ?

Solution
There is a function in Excel called DATEDIF that does not appear within the Insert Function dialog box. Lets say you have entered your starting date in cell A1 and your ending date in cell B1.

Type =DATEDIF(A1,B1,"y") to calculate the number of years.

Type =DATEDIF(A1,B1,"ym") to calculate the number of months.

Type =DATEDIF(A1,B1,"md") to calculate the number of days.

Type =DATEDIF(A1,B1,"y")&" Years,"&DATEDIF(A1,B1,"ym")&" Months,"&DATEDIF(A1,B1,"md")&" Days" to calculate years, months, and days all together.

Back to Questions Index

Return to Excel Exchange homepage.