I need to find the Euclidean distance between two points. I have the concatenated coordinates in a single cell. Each set of coordinates is like (x1,y1,z1)
and (x2,y2,z2)
.
How can I do this in Excel?
microsoft excel
I need to find the Euclidean distance between two points. I have the concatenated coordinates in a single cell. Each set of coordinates is like (x1,y1,z1)
and (x2,y2,z2)
.
How can I do this in Excel?
Best Answer
Try the following User Defined Function (UDF):
User Defined Functions (UDFs) are very easy to install and use:
If you save the workbook, the UDF will be saved with it. If you are using a version of Excel later then 2003, you must save the file as .xlsm rather than .xlsx
To remove the UDF:
To use the UDF from Excel:
=distance(A1,A2)
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
and for specifics on UDFs, see:
http://www.cpearson.com/excel/WritingFunctionsInVBA.aspx
Macros must be enabled for this to work!
Here is an example: