Skip to main content

Excel Formula: Calculate Years Months Days between Two Dates

doc calculate difference between time 5

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.
doc calculate difference between time 5

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.
doc calculate difference between time 5

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

Relative Functions


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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, Edge and Firefox.
Comments (5)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
MOLTE GRAZIE, UTILISSIMO!
This comment was minimized by the moderator on the site
Grazie, MOLTO UTILE!
Rated 5 out of 5
This comment was minimized by the moderator on the site
Not page error, but Parse Error
This comment was minimized by the moderator on the site
Hi, SUHAIL AHMAD NEHVI, could you upload the error picture? I have tested this formula times, it worked. I do not know what the specific problem you meet.
This comment was minimized by the moderator on the site
The above formula shows page error
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations