*58*

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

Î£|A_{i} â€“ B_{i}|

where *i* is the i^{th} element in each vector.

This distance is used to measure the dissimilarity between two vectors and is commonly used in many machine learning algorithms.

The following example shows how to calculate the Manhattan distance between two vectors in Excel.

**Example: Calculating Manhattan Distance in Excel**

Suppose we have the following two vectors, A and B, in Excel:

To calculate the Manhattan distance between these two vectors, we need to first use the **ABS()** function to calculate the absolute difference between each corresponding element in the vectors:

Next, we need to use the **SUM()** function to sum each of the absolute differences:

The Manhattan distance between the two vectors turns out to be **51**.

**Additional Resources**

The following tutorials explain how to calculate other distances in Excel:

How to Calculate Euclidean Distance in Excel

How to Calculate Hamming Distance in Excel