Date differences in years.month format

I have two dates, format dd/mm/yyyy.
I want to calculate the time difference between these two dates, and write it in a format such as this: years.months

So for example if the dates are: 01/02/2020 and 01/05/2022, then the difference would be 2 years and 3 months. Ideally I would want this written as “2.3”

I have gotten to the point where I found how to get the amount of months from the calculations, using these two functions. Assuming one date is in cell A1, the other in cell A2, I then put:

This would give me 27 (months). Assuming this result ends up in C2, I can then follow that up with this:

This would give me (27/12) 2.25. Close to what I want, but ideally I want it as 2.3. Note that I do not want it as 2.3 because of 2.25 rounded up to 2.3, but rather because of 27/12 = 2 with the remainder of 3.

So: is there a way to have the result of a division expressed like that? (Integer.Remainder)

=INT(27/12) & "." & MOD(27;12) - though it’s bad at all to introduce ambiguity of text with numbers ( I’d prefer something like =INT(27/12) & " y " & MOD(27;12) & " m" to make absolutely clear that this is text and not the result of a numerical calculation).

Works like a charm, thanks!

I ended up merging the two together (don’t need/want C2, I just want the final one, the “2.3” one) into this mess right here:

=INT(DATEDIF(A2;B2;“m”)/12) & “.” & MOD(DATEDIF(A2;B2;“m”);12)



you may also use =DATEDIF(A2;B2;"y") & "." & DATEDIF(A2;B2;"ym") removing superfluous function calls of INT() and MOD().

Ref: LibreOffice Help - DATEDIF