Computer/Internet Issues & TroubleshootingAnyone with questions about the terribly complex world of computers or the internet should try here. We will also try and help with troubleshooting any technical problems you may have with the forums.

Hi guys, Would anyone happen to know where I can find a ready made formula for Excel that can calculate the distance between 2 sets of WGS84 Lat and Long coordinates? Cheers,

(which you can cut and paste directly into a cell) where one point is at Lat1, Long1 and the other is at Lat2, Long2. The result is in nautical miles.

As the comment in the reference says, you have to convert degrees, minutes and seconds to decimals of degrees, although there is probably a quick way around this that I haven't bothered with. You also have to be careful when the points are on opposite sides of 0 or 180 degrees longitude or of the equator - in each case one set of numbers has to be negative, the other positive. For example, taking west of the Greenich meridian and south of the equator as negative; Manchester is +53.50, -2.25 Kuala Lumpur is +3.13, +101.70 Santiago de Chile is -33.50, -70.67

If I remember correctly, I got that out of the instruction book for a Hewlett Packard HP35 calculator in the 1980s!

GG

Last edited by Groundgripper; 5th Oct 2006 at 11:51.
Reason: Edited for clarity (and history!)

[pedantic mode on] The formula provided does not provide distance on a WGS84 sphereiod, but on a standard sphere. One's round, that other one's roundish.[/pedantic mode off]

Although not exactly what you were looking for, this site will produce great circle distances between lat/long points and by various aviation designators. http://gc.kls2.com/

Now on to the next challenge - an Excel formula to work out the track between two sets of coordinates. Any ideas Groundgripper?

Er, no! And sorry for the delay in responding - busy this weekend. As you will have seen, there are greater minds than mine responding to your query. Stoney X: yes, I realised that it was for a true sphere but had (and still have) no idea about what difference that would make - my interest has never required that accurate an answer! I did google on WGS84 and read this article in Wikipedia, but halfway through everything went blurred and I had to go and have a lie-down in a darkened room for a time! GG

mdc - yes I noticed the website had code for calculating a track, but it's in VB/NET script and I do not posses the technical knowledge nor the programs to use it! Morning Crescent - That's the formula i'm looking for, but it's just a case of converting it to an Excel formulae Groundgripper - no problem, thanks for your help with the distance formula!

Ok, so i've managed to put together a distance and bearing calculator with extremely valuable help and advice from you guys, so many thanks However, I have now hit another problem. Originally when I had completed it, the bearing calculator was working perfect give or take half a degree or so, but if the track crossed the meridian the distance calculator strated spewing random numbers at me. Managed to correct that, but now the track headings go out the window when the track crosses the meridian!

Anyone have any ideas? I have tried everything I can think of and more over the last week, i've checked every bit of coding 3 of 4 times, and I still can't work it out. It's enough to make you loose the will to live!

If anyone could shed any light on this problem, I would be extremely grateful

Finally figured out what was going wrong! I now have a fully working distance and track calculator. Many thanks guys, couldn't have done it without the help I recieved for you lot!