 # Calculate difference between two cells - Part 2

I’m doing a mileage spreadsheet for my car,

``````In cell A1 heading = Mileage
in cell A2 value = 50000
In cell A3 value = 50100
In cell A4 value = 50200
..and so on
``````

Difference amount goes into Cell B2

So in this case B2 = 200 (A4-A2)

Without knowing how many entries will be introduced in column A (could be 10 or could be 110 entries) How can I ask calc to calculate the difference between the last entry in Column A and the first Entry in Column A (A2)

So Basically I just want to subtract the first entry from the last current entry In Column A with out out knowing how many entries there might be using an array formula.

Thanks again for the help

I can’t see that your post is a wiki. Sorry.

Please name the cells like A1; A2 and so on; it’s a convention

So you need the MAXimum of column A. Alter the formula this way:

Write in B2 the following formula: `=MAX(A:A)-A2`

Tested on LO 5.4.0.3 - be aware that =MAX(A:A) does not work in some previous versions or Apache OpenOffice.

Cheers