Arte SheetsLearn. Try. Understand.

Engineering

Distance formula: 2D and 3D Euclidean vs Manhattan grid distance

Calculate straight-line Pythagorean distance in 2D or 3D space with SQRT, and compare right-angle warehouse aisle distance with ABS.

Straight-line Pythagorean vs right-angle aisle distance

Between points (X1, Y1) = (2, 3) and (X2, Y2) = (5, 7), horizontal delta is 3 and vertical delta is 4. Straight-line Euclidean distance equals SQRT((X2 - X1)^2 + (Y2 - Y1)^2) = SQRT(9 + 16) = 5.

Adding vertical rack height (Z2 - Z1)^2 inside SQRT extends the exact same formula to 3D coordinates (SQRT(3^2 + 4^2 + 12^2) = SQRT(169) = 13), while ABS(X2 - X1) + ABS(Y2 - Y1) computes right-angle Manhattan travel along rectangular aisles (3 + 4 = 7).

Use Cartesian coordinates in the same units, not latitude/longitude degrees. Manhattan distance assumes unobstructed axis-aligned travel; real obstacles and permitted routes can make actual travel longer.

Point 1 (X1,Y1,Z1)Point 2 (X2,Y2,Z2)2D Euclidean3D Euclidean2D Manhattan
(2, 3, 0)(5, 7, 12)5137
(2, 3, 0)(2, 3, 0)000

2D, 3D, and Manhattan distance formulas

Parenthesize each coordinate difference before squaring so the exponent applies to the whole difference. This also avoids relying on engine-specific unary-minus precedence.

=ROUND(SQRT((D2 - A2)^2 + (E2 - B2)^2), 4)

3D Euclidean distance formula

Include (F2 - C2)^2 inside SQRT for 3D CAD, drone, or warehouse rack coordinates.

=ROUND(SQRT((D2 - A2)^2 + (E2 - B2)^2 + (F2 - C2)^2), 4)

Try the example

Use the original values or change them to test your understanding.

Further reading