I have two datasets in LibreOffice Calc containing the Cartesian coordinates of objects in a plane. One is old data with X number of objects, the other is newer data with the same X objects + N new ones.

Excel Spreadsheet:

```
      A          B          C          D     ||    E       F        G
      |          |          |          |     ||    |       |        |
1 - New ID  Previous ID  X Value    Y Value  || Old ID  X Value  Y Value
2 -  1a          ?        89.09      73.79   ||   1a     52.60    94.15 
3 -  1b          ?        52.50      94.05   ||   1b     81.20    28.49
4 -  1c          ?        36.72      94.85   ||   2a     91.04    38.93
5 -  2a          ?        81.14      28.38   ||   3a     68.65    84.64
6 -  2b          ?        07.50      46.69   ||   3b     64.50    37.18
7 -  3a          ?        90.72      39.00   ||   4a     18.36    03.65

```

For each old object's coordinates (columns F and G), I want to go through all the new objects' coordinates (columns C and D) and see if the distance *d* between the two is very small (for me a value of less than `1` will suffice). 

```
d = SQRT( (X2-X1)^2 + (Y2-Y1)^2 )

```

If *d* < 1 then this means that they are the same object and I want to record its `Old ID` in column B.

```
=IF(SQRT((C2-$F$2)^2+(D2-$G$2)^2)<1,$E$2,0)

```

The above formula works for one object at a time when I click and drag until an ID appears; however, I have to copy and paste things around a lot to keep doing this method. The problem is that I have about 260 new objects to search through for around 180 old objects. Manual click-and-drag is too laborious.

I haven't been able to come up with a way to use VLOOKUP or INDEX to tell Excel "For these X and Y values in cells F2 and G2, go check the values in C2 and D2. If d is < 1 then print E2. If not go check F3 and G3 and print E3 if it's true *et cetera et cetera* until you find a match."

Does anyone have any advice on how to get this to work?

I know if the coordinates were *exactly* the same for an object in the old and new data then I could just use an INDEX MATCH combination but unfortunately they do differ slightly.