PPRuNe Forums

PPRuNe Forums (https://www.pprune.org/)
-   Computer/Internet Issues & Troubleshooting (https://www.pprune.org/computer-internet-issues-troubleshooting-46/)
-   -   Excel Distance Calculator Formulae (https://www.pprune.org/computer-internet-issues-troubleshooting/246720-excel-distance-calculator-formulae.html)

Oxeagle 5th Oct 2006 08:06

Excel Distance Calculator Formulae
 
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,

Ox

mdc 5th Oct 2006 10:57

Is this what your looking for http://www.tma.dk/gps/#calcdist

Groundgripper 5th Oct 2006 11:32

Not familiar with WGS84 co-ordinates, but that looks like the calculation I use:

=SUM(60*ACOS((SIN(Lat1*PI()/180)*SIN(Lat2*PI()/180)+COS(Lat1*PI()/180)*COS(Lat2*PI()/180)*COS((Long2-Long1)*PI()/180)))*180/PI())

(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

Oxeagle 5th Oct 2006 12:30

That's perfect Groundgripper, thanks very much! :ok: Also thanks to mdc for your time as well :)

Oxeagle 6th Oct 2006 12:46

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

Cheers

Stoney X 6th Oct 2006 13:27

[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]

innuendo 6th Oct 2006 16:17

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/

mdc 7th Oct 2006 16:44

Oxeagle,

On the previous link I've mentioned I thought there was formula to calculate this.

Mornington Crescent 8th Oct 2006 09:29

Hi OA

This is what I use. Sorry about the brackets!

Initial True Track = arcos [ (sin LatB - sin LatA* cos(Dist/60))/(sin (Dist/60) cos LatA)]


if sin (LongA - LongB) < 0
then (360-Initial True Track)
is used

Where:

Start Position
Lat A
Long A

Finish Position
Lat B
Long B

Groundgripper 8th Oct 2006 21:25


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

Oxeagle 9th Oct 2006 09:09

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!

Mornington Crescent 9th Oct 2006 13:16

OA

Check your PMs

MC

Oxeagle 18th Oct 2006 15:24

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 :ok: 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! :ugh: :{ :mad:

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

Cheers,

Ox

Been Accounting 18th Oct 2006 17:17

Aviation Formulary V1.43
 
This should keep you happy!

http://williams.best.vwh.net/avform.htm

Oxeagle 20th Oct 2006 15:00

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! :ok:

Ox


All times are GMT. The time now is 03:34.


Copyright © 2024 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.