Hi Excel Geniuses
I've got a doozy of a question. I'm trying to take a center point (lat/long) and then use that value to reference a table to find the three closest matches by lat/long proximity.
Here is a simplified example:
The first spreadsheet has the centering location value and we want to populate the three closest cities from referencing the second table
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Latitude[/TD]
[TD]Longitude[/TD]
[TD]Closest City 1[/TD]
[TD]Closest City 2[/TD]
[TD]Closest City 3[/TD]
[/TR]
[TR]
[TD]San Fran[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]37.781383[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-122.460533[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The second table is thousands of rows long and has one lat/long per row
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Latitude[/TD]
[TD]Longitude[/TD]
[/TR]
[TR]
[TD]Denver[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]40.395369[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-104.756684[/TD]
[/TR]
[TR]
[TD]Chicago[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]41.92975[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-87.7467[/TD]
[/TR]
[TR]
[TD]Cleveland[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]41.418133[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-81.787063[/TD]
[/TR]
[TR]
[TD]Asheville[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]35.53621[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-82.60152[/TD]
[/TR]
[TR]
[TD]Houston[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]29.6795[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-95.538717[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any idea how to use either a formula or VBA to make these proximity matches??
Thanks!!!
I've got a doozy of a question. I'm trying to take a center point (lat/long) and then use that value to reference a table to find the three closest matches by lat/long proximity.
Here is a simplified example:
The first spreadsheet has the centering location value and we want to populate the three closest cities from referencing the second table
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Latitude[/TD]
[TD]Longitude[/TD]
[TD]Closest City 1[/TD]
[TD]Closest City 2[/TD]
[TD]Closest City 3[/TD]
[/TR]
[TR]
[TD]San Fran[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]37.781383[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-122.460533[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The second table is thousands of rows long and has one lat/long per row
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Latitude[/TD]
[TD]Longitude[/TD]
[/TR]
[TR]
[TD]Denver[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]40.395369[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-104.756684[/TD]
[/TR]
[TR]
[TD]Chicago[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]41.92975[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-87.7467[/TD]
[/TR]
[TR]
[TD]Cleveland[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]41.418133[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-81.787063[/TD]
[/TR]
[TR]
[TD]Asheville[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]35.53621[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-82.60152[/TD]
[/TR]
[TR]
[TD]Houston[/TD]
[TD][TABLE="width: 106"]
<tbody>[TR]
[TD="width: 53, align: right"]29.6795[/TD]
[TD="width: 53, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]-95.538717[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any idea how to use either a formula or VBA to make these proximity matches??
Thanks!!!
Last edited: