distance.xlsxBelow is a perl sub you could embed in a perl script. It assumes you have a min RTT and the lat longs of source and destination. You could also extract the code to calculate the distance.
Alternatively if you have the lat longs in spreadsheet columns then you could write a function (see the attached spread sheet).
...