Any way to show years and days between two dates - DateDif configuration?

hi
Just wanted to find out if there is any DateDif configuration that would show the number of years and days between two dates eg. the difference between 12/12/1945 and 14/11/2017 is 71 years and 28 days. Or indeed some other formula?
Thanks
LVL 1
agwalshAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
ShumsDistinguished Expert - 2017Commented:
Assuming you have Start Date in A2 & End Date in B2, try below formula in C2:
=DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months, "&B2-DATE(YEAR(B2),MONTH(B2),1)&" days"

Open in new window

DatedIF
0
 
Pawan KumarDatabase ExpertCommented:
You can use this formula.

=DATEDIF(yourstartdate,yourenddate,"y") &" years,"&DATEDIF(yourstartdate,yourenddate,"ym") &" months &DATEDIF(yourstartdate,yourenddate,"md") &" days"

Replace - yourstartdate and yourenddate with your Start Date , yourenddate  column Number.
0
 
Rgonzo1971Commented:
Hi,

pls try
=DATEDIF(A1,B1,"Y")&" year(s) "&IF(DATEDIF(A1,B1,"Y")>=0,DATEDIF(EDATE(A1,DATEDIF(A1,B1,"Y")*12),B1,"d")&" day(s)","")

Open in new window

Regards
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ShumsDistinguished Expert - 2017Commented:
If you are just after years and days then try below:
=DATEDIF(A2,B2,"y")&" years and "&DATEDIF(A2,B2,"md")&" days"

Open in new window

Calculate-Year-Days.xlsx
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Rob HensonFinance AnalystCommented:
For just years and days as requested, how about:

=INT(YEARFRAC(A2,B2,1))&" years "&TEXT(MOD(YEARFRAC(A2,B2,1),1)*365,"0")&" days."

For those two dates given, it gives "71 years 337 days".  I can see where you have got the 28 days, 14/11 to 12/12 but as the December is in a prior year, it would be 365 less 28 ie 337.
0
 
agwalshAuthor Commented:
Thanks to all of you - Experts' Exchange rides to the rescue again !
0
 
Rob HensonFinance AnalystCommented:
Don't understand why you gave points to incorrect answers; for the dates given, the result should be 71 years and 337 days or 71 years 11 months 28 days. Quick assessment of all solutions.

Shums first suggestion
=DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months, "&B2-DATE(YEAR(B2),MONTH(B2),1)&" days"
Result: 71 years, 11 months, 13 days  incorrect by 15 days

Pawans suggestion with dates inserted:
=DATEDIF(A2,B2,"y") &" years, "&DATEDIF(A2,B2,"ym") &" months "&DATEDIF(A2,B2,"md") &" days"
Result:  71 years, 11 months 2 days   incorrect by 26 days

RGonzo1971 suggestion:
=DATEDIF(A2,B2,"Y")&" year(s) "&IF(DATEDIF(A2,B2,"Y")>=0,DATEDIF(EDATE(A2,DATEDIF(A2,B2,"Y")*12),B2,"d")&" day(s)","")
Result:  71 year(s) 337 day(s)   Correct

Shums second:
=DATEDIF(A2,B2,"y")&" years and "&DATEDIF(A2,B2,"md")&" days"
Result:  71 years and 2 days   incorrect by 335 days yet accepted as answer.

My suggestion:
=INT(YEARFRAC(A2,B2,1))&" years "&TEXT(MOD(YEARFRAC(A2,B2,1),1)*365,"0")&" days."
Result: 71 years 337 days.   Correct.

Thanks
Rob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.