Created
November 27, 2024 17:58
-
-
Save matthews-p/48e0408c0392e48ea1d948963bffda3c to your computer and use it in GitHub Desktop.
GetDistanceMiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** GetDistanceMiles */ | |
/* | |
FUNCTION NAME: GetDistanceMiles | |
DESCRIPTION: Returns the distance in miles between points X and Y based on their | |
decimal latitude and longitude coordinates | |
ARGS: | |
LatX: Point X's decimal latitude | |
LngX: Point X's decimal longitude | |
LatY: Point Y's decimal latitude | |
LngY: Point Y's decimal longitude | |
EXAMPLE: | |
=GetDistanceMiles(39.4567,-109.123,33.789,-120.3456) | |
*/ | |
GetDistanceMiles = LAMBDA( | |
LatX, | |
LngX, | |
LatY, | |
LngY, | |
ACOS( | |
COS(RADIANS(LatX)) * COS(RADIANS(LatY)) * COS(RADIANS(LngY - LngX)) + | |
SIN(RADIANS(LatX)) * SIN(RADIANS(LatY)) | |
) * 3959 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment