Excel As-the-crow-flies distance
The demo file offers three ways to calculate the as-the-crow-flies distance, the shortest distance between two geographical locations specified by latitude and longitude.- Regular formula. As it is a pretty long one, it might be a bit cumbersome to adjust it and link it to input fields.
- VBA - User Defined Function (UDF) GlobeDistance. Much easier to read and link. But will execute noticeable slower if you use this function in thousands of cells, because programming language VBA is slow. You can set its optional argument InMiles to TRUE/FALSE to retrieve distance in miles/kilometers. Default is in kilometers!
- LAMBDA function L_GlobeDistance. LAMBDA functionality exists since Office365/Excel 2021. LAMBDA functions are user defined functions created directly within Excel's Name Manager. Executes fast. You can set its optional argument InMiles to TRUE/FALSE to retrieve distance in miles/kilometers. If omitted, then it returns the distance in kilometers!
Download demo file (32kB - downloaded 3187 times)
Online version