View Single Post
 
Old 02-03-2015, 03:24 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

FWIW, the standard formula for calculating the distance between two lat/lon coordinates is:
Code:
ACOS(SIN(RADIANS(Lat1))*SIN(RADIANS(Lat2))+COS(RADIANS(Lat1))*COS(RADIANS(Lat2))*COS(RADIANS(Long1-Long2)))*RadiusEarth
That's the basic formula my solution uses. It's not especially accurate at very small differences, particularly near the poles, but that's of no consequence for this exercise, and any errors will still scale according to the differences in the true distances. Without the '*RadiusEarth' part (6367.465km on average), you simply get a value applicable to any size sphere. Indeed, the above formula all there is to the second one in post #8, except that one also uses the MIN function in an array formula to return the minimum distance.

The MATCH function simply uses two of these formulae (without the '*RadiusEarth' part), first with the MIN function to calculate a minimum spherical value, the second without the MIN function to find which row produces that value. The INDEX function merely outputs the corresponding name from the row returned by the MATCH function in column C.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote