# 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.

### Excel Facts

To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

#### jtakw

##### Well-known Member
Hi,

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

Book1
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
Sheet707
Cell Formulas
RangeFormula
F2=IFERROR(IF(C2="","",C2-LOOKUP(9.99999999999999E+307,C\$1:C1)),"")

#### 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?

Replies
1
Views
2K
Replies
1
Views
413
Replies
4
Views
864
Replies
1
Views
821
Replies
0
Views
293

1,170,942
Messages
5,872,859
Members
432,950
Latest member
ALeXceLBr

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back