Google Answers Logo
View Question
 
Q: How do you set up Microsoft Excel to compute distances between 3D coordinates? ( Answered 4 out of 5 stars,   12 Comments )
Question  
Subject: How do you set up Microsoft Excel to compute distances between 3D coordinates?
Category: Computers > Software
Asked by: scholarman-ga
List Price: $25.00
Posted: 14 Jun 2002 00:33 PDT
Expires: 14 Jul 2002 00:33 PDT
Question ID: 25616
I would like to create an Excel spreadsheet with the appropriate
formulae to compute the distances between different points in
three-dimensional coordinates (X, Y and Z). So, for example, if I
decide Point A is at 15, 190, -5 and Point B is at 210, 185, 22, it
would be able to give me the distance between Point A and B
automatically. Obviously, I need to know how to enter all three
coordinates into the system for each point, and how to then
interrelate the points to one another on their graph.

I'm looking for relatively specific instructions, with the appropriate
functions and formulae listed to make this work properly in Excel.
Thanks!
Answer  
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinate
Answered By: juggler-ga on 14 Jun 2002 01:34 PDT
Rated:4 out of 5 stars
 
Hi.
The basic formula is:
distance (Point3D x1 y1 z1) (Point3D x2 y2 z2)
    = sqrt ( (x1 - x2)^2 + (y1 - y2)^2  + (z1 - z2)^2 )

See the following web site for a full discussion under "coordinate
system":
http://fuzzyphoton.tripod.com/rtref_c.htm

There are any of a number of ways you can set this up in Excel, but
let's say that you put (x1, y1, z1) in spreadsheet cells A1, B1, C1,
and you put (x2, y2, z2) in cells D1, E1, F1.
Then in cell G1, you'd put your formula:
=SQRT((A1-D1)^2+(B1-E1)^2+(C1-F1)^2)

The distance would then display in G1. 


I hope this helps. Good luck.
scholarman-ga rated this answer:4 out of 5 stars
The answer was quite good and quite complete, though the comments
below it really helped to flesh it out. In either case, I'm thrilled
this service exists. Take the money and accept my thanks!

Comments  
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinate
From: quesera-ga on 14 Jun 2002 01:52 PDT
 
There's a small (but huge) error in the above answer...

You have to take the absolute value of the differences between each
point to get the "distance" between them.  Otherwise, if any value in
the "second" point is greater than the corresponding value on the
"first" point, your results will be skewed.

formula should be:
=sqrt( abs(a1-d1)^2 + abs(b1-e1)^2 + abs(c1-f1)^2 )

Good sets of numbers to test on:
(0,0,0) and (3,4,12) .  Should result in 13 exactly.
(10,20,30) and (13,24,42) . Should get same answer.

Another good test:
(13,24,42) and (10,20,30) .  Should get same answer.

You should be able to switch the values for point 1 with point 2 and
get the same answer every time.  San Francisco is as far away from
Boston as Boston is from San Francisco.
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinate
From: juggler-ga on 14 Jun 2002 02:03 PDT
 
Maybe I'm missing something, and I haven't taken in math class since
1989, but I fail to see why the absolute value is necessary. Doesn't
squaring a negative number only return a positive number???
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: jmartinj-ga on 14 Jun 2002 02:08 PDT
 
Hi juggler,

Unless imaginary parts come to play, ABS(x1 - x2)^2 is exactly equal
to (x1 - x2)^2. Obviously you needed either a sleep or a mountain dew
at the time you wrote your comment :)
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinate
From: juggler-ga on 14 Jun 2002 02:12 PDT
 
jmartin: do mean my comment or quesera's?
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: jesin-ga on 14 Jun 2002 02:15 PDT
 
No need to take the absolute as the square of a negative number is
always positive. (Don't get lost in the long (incorrect) explanation
in the first comment...)
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinate
From: ralphmartin-ga on 14 Jun 2002 02:22 PDT
 
Ignore the chap who said there is a mistake in the answer concerning
negative distances. Squaring (A1-d1) etc does indeed allow for this in
the correct way.
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: wireframe-ga on 14 Jun 2002 02:33 PDT
 
Assuming that the X coordinates are in the 1st row (A1, B1, C1) and
the Y coordinates are in the 2nd row (A2, B2, C2) the actual Excel
formula should look like this  =SQRT(SUMXMY2(A1:C1,A2:C2)).
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: wireframe-ga on 14 Jun 2002 03:16 PDT
 
Please ignore the gibberish I posted above. The comment I meant to
post is:

Assuming that the coordinates for the first point are in the 1st row
(A1 , B1, C1) and the coordinates for the second point are in the 2nd
row (A2, B2, C2) the actual Excel formula should look like this 
=SQRT(SUMXMY2(A1:C1,A2:C2)). You can quickly add more sets of points
by highlighting all seven cells (the 3 for each point plus the one
cell that has the result in it) and then copy/pasting to a new set of
cells.
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinate
From: quesera-ga on 14 Jun 2002 03:21 PDT
 
sorry, mea culpa magna.  sleep or mountain dew, definitely one or the
other.
you're all right and i'm wrong.

well, i'm wrong about the first answer being wrong, anyway.  my answer
is correct, but incompletely simplified.  that's what i get for doing
the math instead of looking it up.  :-)

apologies all around.
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: fastpenguin-ga on 14 Jun 2002 04:46 PDT
 
I would strongly suggest you to use StarCalc, instead Microsoft Excell.
StarOffice from Sun Microsystems has much more power than Microsoft's one.
StarOffice Homepage: http://wwws.sun.com/software/star/staroffice/6.0/index.html
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: wireframe-ga on 14 Jun 2002 04:47 PDT
 
Please ignore the gibberish I posted above. The comment I meant to
post is:

Assuming that the coordinates for the first point are in the 1st row
(A1 , B1, C1) and the coordinates for the second point are in the 2nd
row (A2, B2, C2) the actual Excel formula should look like this 
=SQRT(SUMXMY2(A1:C1,A2:C2)). You can quickly add more sets of points
by highlighting all seven cells (the 3 for each point plus the one
cell that has the result in it) and then copy/pasting to a new set of
cells.
Subject: Re: How do you set up Microsoft Excel to compute distances between 3D coordinates?
From: elevener-ga on 01 Jul 2002 17:56 PDT
 
Occasionally found your post about Mac X and Palm Desktop.

It's impossible to answer there, so have a look at link
http://www.palm.com/software/desktop/mac.html

it allows downloading for free 4.01 version of Pal Desktop for MAC, that
works on OS X.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy