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

Get FREE Advanced Excel Exercises with Solutions!

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.


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.


How to Calculate Manhattan Distance in Excel: 2 Suitable Ways

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.


Download Practice Workbook

You can download the practice workbook from here.


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.


<< Go Back to Distance | Formula List | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Mukesh Dipto
Mukesh Dipto

Mukesh Dipto is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including Rhino3D, Maxsurf C++, AutoCAD, HTML, CSS, JavaScript, and WordPress. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role, he... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo