简体   繁体   中英

Excel formula to calculate date difference in years and months

I'm trying to come up with an Excel formula that will calculate the difference in years and months between a date in the past and today.

For example, the following tells me the number of days between a cell and now:

=INT((TODAY()-C2))

But I then need to format that value as Year and Month(s).

Obviously I'm no expert in Excel and appreciate any help!

Thanks in advance,

Dan

Alas, what I did was a simple diff and got a result in year and percent, which will work fine:

=((TODAY())-(D2))/365

The DATEDIF was a total disaster, with really odd, inconsistent results.

Thanks for all the suggestions though!

Looking at the Microsoft Office knowledgebase , I see a YEAR function that may be used:

A1: 1-Jan-2014
A2: 4-Dec-2016
A3: =YEAR(A2)-YEAR(A1) # will yield 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM