I have 2 tables where I am trying to get a closest match without writing a lengthy macro.
Table 1 has columns: ID, Distance, Latitude, Longitude
Table 2 has columns: ID, Distance
I'm trying to add latitude and longitude to the second table but with this complication: the distances don't exactly match. But the ID's should.
So I want to get the latitude and longitude from table 1 for EXACT ID match, and approximate Distance match. I've been playing around with different formulas from different forums including this one, but none are giving me what I want.
Any advice would be very appreciated.
I've attached a sample file with data changed. Table1 has ID, Distance, Latitude and Longitude. Table2 has same ID's, different distances, and needs closest latitude and longitude from Table1.
A 3150 25.156234 110.235375
A 3200 25.157234 110.236585
A 3250 25.158234 110.237795
A 3300 25.159234 110.239005
A 3120
A 3240
the top group there would be table 1, and the bottom group would be table 2. So I would want to grab the latitudes from row 1 for the first one in table 2, and then row 3 for entry #2, if that makes sense.
Bookmarks