Excel Formula: Calculate Years Months Days between Two Dates
In Excel, you usually calculate the difference between two dates and display the results as days, or months or years. Here this tutorial introduces a formula that displays the difference between two dates as A years B months C days, such as 3 years 2 months 1 days.
If you want to follow along with this tutorial, please download the example spreadsheet.
Generic formula:
DATEDIF(start_date,end_date,"y")&" years "&DATEDIF(start_date, end_date,"ym")&" months " &DATEDIF(start_date, end_date,"md") &" days" |
Arguments
Start_date, end_date: the starting date and ending date that you want to calculate the years, months and days between. |
Error
If the argument end_date is smaller than start_date, the formula returns an error value #NUM!.
How this formula work
To calculate the difference between two dates in cell B3 and C3 and show the result as years months and days, please use below formula:
=DATEDIF(B3,C3,"y")&" years "&DATEDIF(B3, C3,"ym")&" months " &DATEDIF(B3, C3,"md") &" days" |
Press Enter key.
Then format the results as date format by clicking Home > Number Format drop-down menu > Short Date or Long Date.
Explanation
DATEDIF function: This function returns the number of years, months, or days between two given dates.
DATEDIF(B3,C3,"y") returns the number of years between two dates.
DATEDIF(B3, C3,"ym") returns the number of months ignoring years and days between two dates.
DATEDIF(B3, C3,"md") returns the number of days ignoring years and months between two dates.
& is a connector that connects the results of each parts in the formula together.
Relative Formulas
- Calculate Difference Between Two Dates
Here in this tutorial, it introduces the formulas on calculating difference between two dates in years, months, weeks, and days. - Calculate Calculate Days Hours Minutes Seconds Between Two Dates
Sometimes, we may want to get the days, hours, minutes, and seconds between two datetimes, this tutorial introduces the formula to solve this job. - Calculate Days Remaining Between Two Dates
Here, this tutorial provides a formula to quickly calculate the left days between two dates. - Calculate Hours Minutes Seconds Between Two Times
Here in this tutorial, it introduces some formulas to quickly present the time difference result as single time unit.
Relative Functions
- Excel IF Function
Test for specified conditions, then returns the corresponding values - Excel VALUE Function
Convert text to number. - Excel MONTH Function
The MONTH is used to get the month as integer number (1 to 12) from date. - Excel DAY Function
DAY function gets the day as a number (1 to 31) from a date - Excel YEAR Function
The YEAR function returns the year based on the given date in a 4-digit serial number format.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.
- Designed for 1500 work scenarios, helps you solve 80% Excel problems.
- Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
- Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
- 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.





