I have a listing of latitude and longitude for all US zip code centroids. I want to find the distance between two zip codes using a simple formula in Excel. I have seen this formula in several forums:
=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon2-lon1))*6371 [this is for km]
This does not come remotely close (tells me that the town 4 miles away is 219 km!)
This formula does seem to work:
=ACOS(COS(RADIANS(90-Lat1)) * COS(RADIANS(90-Lat2)) + SIN(RADIANS(90-Lat1)) * SIN(RADIANS(90-Lat2)) * COS(RADIANS(Long1-Long2))) * 6371
Again, I have found that first formula posted many times. Is there a typo in there somewhere or am I reading something wrong?