The straight-line distance between two points is the square root of the summed squared differences. SQRT + SUMSQ compute it in one tidy formula — in 2D, 3D, or any number of dimensions.
The example
(0,0) to (3,4) = 5.
| A | B | |
|---|---|---|
| 1 | Points | Distance |
| 2 | (0,0)→(3,4) | 5 |
| 3 | (1,2)→(4,6) | 5 |
The formula
The formula:
How it works
How it works:
SUMSQ(x2-x1, y2-y1)squares each coordinate difference and adds them.SQRT(…)takes the square root — the straight-line (Euclidean) distance.- It’s the Pythagorean theorem: distance² = Δx² + Δy².
- Extend to 3D by adding the z difference:
=SQRT(SUMSQ(x2-x1, y2-y1, z2-z1)).
Manhattan distance is the grid-walking alternative — =ABS(x2-x1)+ABS(y2-y1) — useful when movement is restricted to axes (city blocks, warehouse aisles). Euclidean is the crow-flies distance; Manhattan is the taxi route.
Try it: interactive demo
Two points.
Variations
3D distance
Add a z axis:
Manhattan
Grid distance:
Simple Pythagoras
Two legs:
Pitfalls & errors
Order doesn’t matter. Squaring removes the sign, so x2−x1 and x1−x2 give the same distance.
Mixed units. All coordinates must share the same scale or the distance is meaningless.
Euclidean ≠ Manhattan. Pick the metric that matches how movement actually happens.
Practice workbook
Frequently asked questions
How do I calculate the distance between two points in Excel?
How do I extend it to 3D?
What's Manhattan distance?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class