How to Calculate Manhattan Distance in Excel (2 Suitable Ways)

This tutorial will show how to calculate Manhattan distance in Excel. From the name, we can get an assumption that it is named after the famous city Manhattan in the USA. This feature of calculation is applicable not only in generic mathematics but also in statistics. To illustrate the concept of this article, we will use unique datasets. So, you will get a clear overview of the Manhattan distance calculation. Let’s start the discussion of this article.


Download Practice Workbook

You can download the practice workbook from here.


What Is Manhattan Distance?

The Manhattan distance is a measure that calculates the distance between two points as the sum of their Cartesian coordinates’ absolute differences. To put it another way, it is the total sum of the differences between the x and y coordinates. We can use the following formula to calculate the Manhattan distance between two vector points A and B:

∑ΙAj -BjΙ

Here, j is the jth item in each vector.

The Manhattan distance refers to how much the two vectors are different from one another.


2 Suitable Ways to Calculate Manhattan Distance in Excel

Throughout this article, we will demonstrate 2 suitable ways to calculate the Manhattan distance in Excel. We will consider 2 different scenarios to calculate the Manhattan distance. The first method will depict 2D Manhattan distance and the second one will depict 3D Manhattan distance.


1. Use ABS Function to Calculate Manhattan Distance in Excel

First and foremost, we will use the ABS function to calculate the Manhattan distance in excel. The ABS function in Excel returns the absolute value of a number. It makes negative numbers into positive numbers. But, it doesn’t make any changes to positive numbers. Assume, we have the following dataset. The dataset contains different coordinates of two points A and B. We will calculate the Manhattan distance between these two points with the ABS function.

Use ABS Function to Calculate Manhattan Distance in Excel

Let’s see the steps to implement this method.

STEPS:

  • To begin with, select cell D5.
  • In addition, insert the below formula in that cell:
=ABS(B5-C5)

Use ABS Function to Calculate Manhattan Distance in Excel

  • Press Enter.
  • As a result, we get the absolute distance between the first two Coordinates of A and B.
  • Furthermore, drag the Fill Handle tool from cell D5 to D9.
  • So, we get results like the following image.

Use ABS Function to Calculate Manhattan Distance in Excel

  • Then, select cell D11.
  • After that, type the following formula in that cell:
=SUM(D5:D9)

  • Hit Enter.
  • Finally, we get the value of Manhattan distance in cell D11.


2. Calculate 3D Manhattan Distance in Excel

This method will demonstrate how to calculate 3D Manhattan distance in Excel. Suppose We have a dataset like the following. The dataset contains two points A and B. The coordinates of these two points are:

A = (6.25, 4.75, 5.25)

B = (8, 8, 1)

We can see that the points are in 3D format. Here, we want to calculate the Manhattan distance between these two 3D points.

Calculate 3D Manhattan Distance in Excel

So, follow the below steps to perform this action.

STEPS:

  • Firstly, select cell C9.
  • Secondly, type the following formula in that cell:
=SUM(ABS(B5:B7-C5:C7))

Calculate 3D Manhattan Distance in Excel

  • Now, press Enter.
  • Lastly, we can see the value of Manhattan distance in cell D11.


Conclusion

In conclusion, this tutorial is a complete guide to calculating the Manhattan distance in Excel. Also, Use the practice worksheet that comes with this article to put your skills to the test. If you have any questions, please leave a comment below. Our team will try our best to respond to you as quickly as possible. Keep an eye out on our site ExcelDemy.com for more creative Microsoft Excel solutions in the future.


Related Articles

Mukesh Dipto

Mukesh Dipto

Hi there! I am Mukesh Dipto. I graduated with a bachelor's degree in engineering. Currently, I am working as a technical content writer in ExcelDemy. You will find all my articles on Microsoft Excel on this site. Outside of the workplace, my hobbies and interests include sports and meeting new people. I also enjoy sports. My favorite sports are football (to watch and play) and Badminton (play).

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo