Different Between Two Dates Returning Number of Years, Months, Days

gymwrecker

Active Member
Joined
Apr 24, 2002
Messages
390
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Need help with the following:

I have the following two dates.

A1=20090930
B1=20200531

I need the formula to return the following in C1: "XX Years, XX Months, XX Days".

Note: I searched the forum and couldn't find a formula for this.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Does this give you what you need?

=DATEDIF(DATE(LEFT($A$1,4),MID($A$1,5,2),RIGHT($A$1,2)),DATE(LEFT($B$1,4),MID($B$1,5,2),RIGHT($B$1,2)),"y") & " Years, " & MOD(DATEDIF(DATE(LEFT($A$1,4),MID($A$1,5,2),RIGHT($A$1,2)),DATE(LEFT($B$1,4),MID($B$1,5,2),RIGHT($B$1,2)),"m"),12) & " Months, " & MOD(DATEDIF(DATE(LEFT($A$1,4),MID($A$1,5,2),RIGHT($A$1,2)),DATE(LEFT($B$1,4),MID($B$1,5,2),RIGHT($B$1,2)),"d"),365) & " Days"
 
Upvote 0
I copied and pasted the formula; everything seems to be right but the years, it's returning the following:
389 Years, 7 Months, 335 Days
 
Upvote 0
My result is different. BTW- what you have in A1 & B1 are not dates, but text? or do you have it formated that way?

1675889430060.png
 
Upvote 0
similar to what @Herakles posted
----------------
Book1
ABC
1200909302020053110 Years, 8 Months, 246 Days
Sheet1
Cell Formulas
RangeFormula
C1C1=LET(a,DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)),b,DATE(LEFT(B1,4),MID(B1,5,2),RIGHT(B1,2)),(DATEDIF(a,b,"y")&" Years, "&MOD(DATEDIF(a,b,"m"),12)&" Months, "&MOD(DATEDIF(a,b,"d"),365)&" Days"))
 
Upvote 0
How about
Excel Formula:
=DATEDIF(A1,B1,"Y")&" Years "&DATEDIF(A1,B1,"ym")&" Months "&DATEDIF(A1,B1,"md")&" Days"
 
Upvote 0
after looking at @Fluff 's post, think he's closer to the right formula, but it's not working for me as a1/b1 aren't date formats. so combining efforts i came up with:
-----------------
multiple posts solutions.xlsx
ABC
1200909302020053110 Years 8 Months 1 Days
difference between dates
Cell Formulas
RangeFormula
C1C1=LET(a,DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)),b,DATE(LEFT(B1,4),MID(B1,5,2),RIGHT(B1,2)),(DATEDIF(a,b,"Y")&" Years "&DATEDIF(a,b,"ym")&" Months "&DATEDIF(a,b,"md")&" Days"))
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,935
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top