How to Calculate the Distance Between Addresses in Excel

Updated July 7, 2026 · Geloky team

"How far is each customer from our depot?" is a spreadsheet question, and Excel can answer it — partly. Here's what Excel does well (straight-line distance between coordinates), what it can't do alone (addresses, driving distance), and how to fill the gaps.

Step 1 — Addresses must become coordinates first

No distance formula accepts "221B Baker Street". If your columns contain addresses, geocode them first — see converting addresses to lat/long in Excel. After that, each row has lat and lon and the math below applies.

Step 2 — Straight-line ("as the crow flies") distance in one cell

With point 1 in A2:B2 and point 2 in C2:D2 (lat, lon):

=6371*ACOS( COS(RADIANS(A2))*COS(RADIANS(C2))*COS(RADIANS(D2)-RADIANS(B2))
           + SIN(RADIANS(A2))*SIN(RADIANS(C2)) )
  • 6371 = Earth's radius in km → result in kilometers. Use 3959 for miles.
  • This is the spherical law of cosines — accurate to a fraction of a percent for any distance that matters in logistics. The haversine variant is equivalent in practice.
  • It's pure math: instant, free, works for a million rows.

Step 3 — When you need driving distance

Straight-line says the two banks of a river are 300 m apart; the bridge says 4 km. Roads, ferries, one-way systems — only a routing engine knows them. From a spreadsheet you have two options:

  • Routing API per row — accurate, but you're writing request loops, handling rate limits, and paying per element.
  • Batch upload — the Geloky distance calculator takes a spreadsheet of origin/destination pairs and returns driving distance and travel time for every row (with options like avoiding ferries), or straight-line if that's all you need. Preview is free.

Rule of thumb

  • Rough radius filters ("within 50 km?") — the Excel formula is enough, and a ×1.2–1.3 road factor approximates driving distance for planning.
  • Cost, ETA, or route decisions — use real driving distance; the road factor breaks down exactly where it's expensive (mountains, rivers, city cores).

Calculate distances for your whole spreadsheet

Upload a CSV or Excel file to the Geloky batch distance calculator — driving or straight-line distance for every origin–destination row, no code needed. Preview your file free before paying anything.

Try the distance calculator
We use cookies for various purposes including analytics and personalized marketing. By continuing to use the service, you agree to our use of cookies as described in the Cookie Policy.   I Agree