*18*

The **Euclidean distance** between two vectors, A and B, is calculated as:

**Euclidean distance = √Σ(A _{i}-B_{i})^{2}**

where:

**Σ**is a Greek symbol that means “sum”**A**is the i_{i}^{th}value in vector A**B**is the i_{i}^{th}value in vector B

To calculate the Euclidean distance between two vectors in Excel, we can use the following function:

=SQRT(SUMXMY2(RANGE1, RANGE2))

Here’s what the formula does in a nutshell:

**SUMXMY2**finds the sum of the squared differences in the corresponding elements of range 1 and range 2.**SQRT**takes the square root of this sum of squared differences.

The end result if the Euclidean distance between the two ranges.

For example, suppose we have the following two vectors, A and B, in Excel:

We can use the following function to calculate the Euclidean distance between the two vectors:

The Euclidean distance between the two vectors turns out to be **12.40967**.

Note that this function will only include complete pairwise observations when calculating the Euclidean distance.

For example, the last two rows in column A would not be included in the calculation of the Euclidean distance between the following two vectors:

The Euclidean distance between the two vectors turns out to be **5.656854**.

**Additional Resources**

How to Calculate Euclidean Distance in R

How to Calculate Euclidean Distance in Python