Google Sheets' replacement for Excel's =DATEDIF()?

google-sheets, google-sheets-formula

Solution

`datedif` is undocumented even in Excel,, just use plain formula in both applications:

=TODAY()-D2

in Excel you can use custom number format: `yy" years "mm" months"`, to get the right format in Google Docs use this formula:

=text(today()-D2, "yy' years 'mm' months'")

P.S.: excel equivalent of this formula is `=TEXT(TODAY()-D2, "yy"" years ""mm"" months""")`

Problem

I imported my Excel spreadsheet to Google and have just one error in the formula that I cannot figure out. I'm looking to calculate an anniversary date/years of service from the start date (D2) and of course today's date, using: ``` =DATEDIF(D2,TODAY(),"y")&" years "&DATEDIF(D2,TODAY(),"ym")&" months" ``` Google is giving me the error "unknown function name DATEDIF". Does anyone know how to make this work in Google Docs?

Original source