Calculate difference between dates showing years months days or year month day for singular units

Phil Smith

Active Member
Joined
Aug 13, 2004
Messages
285
Office Version
  1. 365
Platform
  1. Mobile
Hi everyone. I am trying to work out the difference between two dates and then display the result as years, months & days BUT if the result for each unit is 1, how to display the answer as the singular year month & day. Apologies for my brain fog not allowing me to work it out.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Please:

1. Give an example of what you want the results to look like
2. Give your Excel version, as the answer can vary for older vs. newer versions (I suggest updating your profile to include this)
 
Upvote 0
Please:

1. Give an example of what you want the results to look like
2. Give your Excel version, as the answer can vary for older vs. newer versions (I suggest updating your profile to include this)
Thanks Jeff. Will do that now! I havent been on here for a while. I am using Office 365, currently on an iPad as I am without my PC.

The desired result would be, for example, “10 years 3 months and 2 days” for multiple units, or “ 1 year 1 month 1 day”
 
Upvote 0
If the number is 0, do you still want to see it?
10 years and 2 days
 
Upvote 0
Please try and test the following.

Datedif.xlsm
ABCD
101-01-2130-03-212 months 29 days
1d
Cell Formulas
RangeFormula
D1D1=LET(y,DATEDIF(B1,C1,"y"),m,DATEDIF(B1,C1,"ym"),d,DATEDIF(B1,C1,"md"),IF(y>0,y&" year"&IF(y>1,"s "," "),"")&IF(m>0,DATEDIF(B1,C1,"ym")&" month"&IF(m>1,"s "," "),"")&IF(DATEDIF(B1,C1,"md"),d&" day"&IF(d>1,"s",""),""))
 
Upvote 1
Solution
Please try and test the following.

Datedif.xlsm
ABCD
101-01-2130-03-212 months 29 days
1d
Cell Formulas
RangeFormula
D1D1=LET(y,DATEDIF(B1,C1,"y"),m,DATEDIF(B1,C1,"ym"),d,DATEDIF(B1,C1,"md"),IF(y>0,y&" year"&IF(y>1,"s "," "),"")&IF(m>0,DATEDIF(B1,C1,"ym")&" month"&IF(m>1,"s "," "),"")&IF(DATEDIF(B1,C1,"md"),d&" day"&IF(d>1,"s",""),""))
Sorry for the delay in getting back to you Dave. Wow, that is one hell of a formula! Thank you so much for your hard work in solving the problem and working out a formula to deliver EXACTLY what I requested. 👏 Much appreciated!
 
Upvote 0
Thanks! I used it to calculate the age of my Grandfathers 1937 Dodge Trk when I first drove it in 1969 vs. the age of MY 1971 Monte Carlo when my Grandson will drive it this Thanksgiving 2023!
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,190
Members
449,090
Latest member
bes000

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