Nearest Lon Lat to Waypoint Formula Issue

p500uk

New Member
Joined
Apr 10, 2018
Messages
1
Have adapted an array formula from a previous thread - "Need to compare Latitude & Longitude coordinates to find closest office"

The formula is in C2 and picks up Lon and Lat from A1 & A2 and locates nearest from H2:J7:

Code:
{=INDEX($H$2:$H$7;MATCH(SMALL((ABS($A2-$I$2:$I$7)^2+ABS($B2-$J$2:$J$7)^2)^(0.5);1);(ABS($A2-$I$2:$I$7)^2+ABS($B2-$J$2:$J$7)^2)^(0.5);0))}

I calculate the result to be 16.09km from the Waypoint however when i tested this i found it to be incorrect as closet in this case is 6394 (Red) at 15.99km

Can anyone see what is wrong within this formula?

ABCDEF
LonLatNearestLonLatDistance
3.5349.736666666764023.310611111149.70816.0

<tbody>
</tbody>






HIJK
TimeLonLatDistance From WayPoint
63883.306361111149.7382516.0726250391
6389.53.3067549.735305555616.0449141001
63943.308111111149.725333333315.997733609
6394.53.308305555649.723861111115.9977815714
64023.310611111149.70816.0900565802
6402.53.310805555649.706527777816.1098474752

<tbody>
</tbody>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top