Distance Between Two Points (Euclidean)

Excel Formulas › Math

All versionsSQRT

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.


Quick formula: distance between (x1,y1) and (x2,y2):
=SQRT(SUMSQ(x2-x1, y2-y1))
Square each coordinate difference, sum them, take the square root — the Pythagorean theorem.

Functions used (tap for the full reference guide):

The example

(0,0) to (3,4) = 5.

AB
1PointsDistance
2(0,0)→(3,4)5
3(1,2)→(4,6)5

The formula

The formula:

=SQRT(SUMSQ(x2-x1, y2-y1)) // Pythagoras

How it works

How it works:

  1. SUMSQ(x2-x1, y2-y1) squares each coordinate difference and adds them.
  2. SQRT(…) takes the square root — the straight-line (Euclidean) distance.
  3. It’s the Pythagorean theorem: distance² = Δx² + Δy².
  4. 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

Live demo

Two points.

Distance

Variations

3D distance

Add a z axis:

=SQRT(SUMSQ(x2-x1, y2-y1, z2-z1))

Manhattan

Grid distance:

=ABS(x2-x1) + ABS(y2-y1)

Simple Pythagoras

Two legs:

=SQRT(a^2 + b^2)

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

📊
Download the free Distance Between Two Points (Euclidean) practice workbook
A distance sheet with the 3D, Manhattan, and Pythagoras variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I calculate the distance between two points in Excel?
Use =SQRT(SUMSQ(x2-x1, y2-y1)) for the straight-line (Euclidean) distance — the Pythagorean theorem.
How do I extend it to 3D?
Add the third coordinate: =SQRT(SUMSQ(x2-x1, y2-y1, z2-z1)).
What's Manhattan distance?
The grid-walking distance =ABS(x2-x1)+ABS(y2-y1), used when movement is restricted to axes.

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

Related formulas: Sum of squares · Powers & roots · Pythagorean theorem

Function references: SQRT · SUMSQ