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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

ShumsExcel & VBA ExpertCommented:
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
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

ShumsExcel & VBA ExpertCommented:
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

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.