Replacing Google Sheets for Excel = DATEDIF ()?

I imported my Excel spreadsheet to Google, and there is only one error in the formula that I cannot understand. I expect to calculate the date / years of service on the anniversary based on the start date (D2) and, of course, today's date, using:

=DATEDIF(D2,TODAY(),"y")&" years "&DATEDIF(D2,TODAY(),"ym")&" months"

Google gives me the error message "unknown function name DATEDIF".

Does anyone know how to make this work in Google Docs?

+5
source share
2 answers

datedif not even documented in Excel, just use a simple formula in both applications:

=TODAY()-D2

Excel : yy" years "mm" months", Google, :

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

P.S.: : =TEXT(TODAY()-D2, "yy"" years ""mm"" months""")

+4

- Google, ,

DDd =DATEDIF($A2;$B2;"d") =INT($B2-$A2)
DDm =DATEDIF($A2;$B2;"m") =12*(YEAR($B2)-YEAR($A2))+MONTH($B2)-MONTH($A2)-(DAY($B2)<DAY($A2))
DDy =DATEDIF($A2;$B2;"y") =YEAR($B2)-YEAR($A2)-IF(MONTH($A2)>MONTH($B2);1;IF(MONTH($A2)=MONTH($B2);DAY($A2)>DAY($B2);0))

https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=8791#p42479

+2

All Articles