How to calculate number of years between two dates in writer

I have two dates in Writer formatted mm/dd/yyyy and want to calculate the number of years between the two dates. It would also be nice to have one or two digit decimal place on this as well.

You can calculate numbers by pressing F2 and entering the calculation in the rudimentary formula bar. The issue you face is that your calculation commences by dividing the months by the days by the years; it is going to go downhill after that.

Writer is a word processor but has some basic arithmetic skills, you can do the calculation if:

  1. The dates are in a table
  2. They are formatted as dates (Table > Number Format > Date > MM/DD/YYYY)
  3. The result cell is formatted as General

In the result cell press F2 and enter after the = sign (<A1>-<B1>)/365. This is as about as accurate as you are going to get in Writer.

If you enter the date in Calc it will recognise that it is a date and convert it to a number but format it as a date, so 07/05/2023 is converted to 45112. Calc is intended to make calculations and is best suited to that, it can do the calculations somewhat more exactly.

1 Like

I appreciate the input, but I have to do this in Writer and I should have stated I am on MacOS. Is there a way to tell which fields (A1, B1, etc) these dates are located?

Columns are numbered by letter, A, B, C, etc. and rows are numbered by digits, 1, 2, 3, etc. It would be nice if Writer showed A,B,C, etc for columns and 1,2,3 for rows while editing. Using the mouse to select works though.
CalculateDatesInTable.odt (14.4 KB)