# Formula to search for most previous match?

#### marteds

##### New Member
I'm setting up a spreadsheet to display monitoring data in the form of X, Y and Z coordinates.

I want to be able to show the relative and cumulative differences between measurements.
The formula for the relative difference is just comparing it to the cell above, whilst the cumulative is comparing the baseline value.

In the attached image, I would like to be able to use a formula to be able to search and compare to most recent reading with coordinates rather than just the blank cells above it.

Keeping in mind that this spreadsheet is going to be populated on an ongoing basis so hard coding formulas won't work.

#### jtakw

##### Well-known Member
Hi,

F2 formula copied across to H2, and down as far as needed:

#### marteds

##### New Member
This worked a treat!
Thanks mate!

Hi,

F2 formula copied across to H2, and down as far as needed:

CDEFGH
1XYZrel. Xrel. Yrel. Z
2100.000500.000200.000
3100.001500.002200.0000.0010.0020.000
4100.002500.003200.0030.0010.0010.003
5
6
7100.003500.004200.0020.0010.001-0.001

</tbody>
Sheet707

Worksheet Formulas
CellFormula
F2=IFERROR(IF(C2="","",C2-LOOKUP(9.99999999999999E+307,C\$1:C1)),"")

</tbody>

<tbody>
</tbody>

#### marteds

##### New Member
Okay so I wanted to expand on the sheet a bit more and will be having multiple points that I would be analyzing, how would you apply the lookup formula for a scenario like this?