Blog→How-To

Calculate Distance Between Two Addresses in Google Sheets

5 July 2026·8 min read

To calculate the distance between two addresses in Google Sheets, install the free InstaMaps add-on and use the formula =DISTANCE(A2, B2). It returns the distance by road, in kilometres by default or miles with "mi", like the distance Google Maps™ gives for a drive. For a whole list of pairs, put the starts in column A and the destinations in column B and fill the formula down.

This process is designed for sales managers defining service territories, real estate analysts comparing property values, and operations teams scheduling field visits. By the end of this guide, you will have a functional spreadsheet that accurately measures spatial gaps, identifies the nearest locations automatically, and maps your addresses without leaving your standard workspace.

TL;DR
  • →Install the free InstaMaps add-on to access spatial formulas in Google Sheets.
  • →Use =DISTANCE(A2, B2) to get the road distance between two addresses: the miles a car actually drives.
  • →Add "straight" as a fourth argument for the as-the-crow-flies distance instead.
  • →Apply =SORT_BY_DISTANCE() to automatically order a list of candidates by proximity.
  • →Use =CLOSEST_TO() to instantly identify the nearest location to a target address.
  • →Map your entire dataset using =INSTAMAP() to generate a live, hosted shareable URL.
No install, no signup
Measure the distances right now
One origin to a whole list, in miles and km.
Try it now →

What you need to calculate distance

To begin measuring spatial relationships in Google Sheets, you need a standard Google account and the InstaMaps add-on. Google Sheets does not include native formulas for geographic distance calculations, so a third-party tool is required to bridge that gap.

Open your browser, navigate to the Google Workspace Marketplace, and install InstaMaps. Once authorised, launch the tool from your sheet by clicking Extensions > InstaMaps > Formulas. This opens a sidebar menu that inserts spatial formulas automatically, meaning you do not need to memorise the exact syntax to build your distance calculator.

InstaMaps operates on a freemium model that is entirely free for standard users. The base tier provides 100 lookups per day. If your project requires a higher volume, you can unlock 1,000 lookups per day at no cost simply by registering an email address. You will need your addresses structured in standard columns before applying the formulas.

Step 1: Calculate the road distance using =DISTANCE()

The core function for measuring spatial gaps is =DISTANCE(). This function evaluates two points-either written addresses or geographic coordinates-and outputs the mathematical measurement between them.

In a typical setup, column A contains your origin addresses and column B contains your destinations. To measure the gap for the first row, input the following formula into cell C2: =DISTANCE(A2, B2).

If cell A2 contains 'Tower Bridge, London' and cell B2 contains 'Wembley Stadium, London', the formula places both locations and returns the distance by road between them. Choose the unit with a third argument, =DISTANCE(A2, B2, "mi") or =DISTANCE(A2, B2, "km"). For the straight-line distance instead (roughly 10.5 miles here), add "straight": =DISTANCE(A2, B2, "mi", "straight").

  1. Formula: =DISTANCE(A2, B2, "mi")

  2. Cell A2: 1600 Amphitheatre Pkwy, Mountain View, CA

  3. Cell B2: 1 Infinite Loop, Cupertino, CA

  4. Result: 8.7

Step 2: Identify the closest location using =CLOSEST_TO()

When managing a list of potential destinations, you often need to know which single location is nearest to a specific origin point. The =CLOSEST_TO() function evaluates a single target against an array of candidates and returns the best match.

Assume cell A2 contains your client's address, and cells B2 through B50 contain a list of your company's regional service centres. To find the nearest centre automatically, use the formula: =CLOSEST_TO(A2, B2:B50).

The cell will display the exact address of the nearest centre from your list. This eliminates the need to manually calculate the distance for every single location and sort the numbers yourself, saving hours of administrative labour when assigning regional accounts or dispatching field technicians to maintenance jobs.

Step 3: Sort a list by proximity using =SORT_BY_DISTANCE()

If you need to organise a complete dataset by proximity rather than finding just one match, use =SORT_BY_DISTANCE(). This function takes a target address and a larger range of data, then reorders the output based on what is closest to the origin.

Using the previous scenario, if you want to see all your service centres ranked from nearest to furthest for the client in cell A2, input: =SORT_BY_DISTANCE(A2, B2:B50).

The formula will output a sorted, vertically expanding array of addresses. This is particularly useful when the closest location is fully booked or unavailable, as the next closest options are already listed directly beneath it. You can pair this with the =INSTAMAP() formula to generate a live, hosted shareable map URL that visually represents this sorted list and automatically updates whenever you alter the underlying addresses.

Worked example: Routing a 47-stop delivery route

Consider an independent agricultural supplier managing deliveries for a local farming community. The dispatcher has a list of 47 distinct farm addresses that need feed deliveries on a specific Tuesday. The depot is located in cell A2, and the 47 destination addresses are listed in cells B2 down to B48.

First, the dispatcher uses =CLOSEST_TO(A2, B2:B48) to determine the logical first stop for the lead driver. Next, they apply =SORT_BY_DISTANCE(A2, B2:B48) to create an ordered manifest, allowing the 5 separate delivery crews to divide the 47 stops into efficient geographic zones rather than driving back and forth across the county.

Once the manifest is finalised, the dispatcher uses =ROUTE_LINK(A2:B48) to generate a clickable hyperlink. This formula pushes the stops directly into turn-by-turn navigation. One link holds up to 100 stops, so all 47 stops fit in a single link. The dispatcher can also give each crew its own link by running =ROUTE_LINK() on that crew's stops.

Limits and honest alternatives

InstaMaps is highly effective for address validation, proximity sorting, and spatial mathematics, but it has specific limitations based on your operational scale and routing complexity.

Very large sheets can run into the daily lookup allowance, so a database of 50,000 historical contacts may need spreading across several days. Road distances are for normal driving, not live traffic.

If your business requires live traffic avoidance, toll cost calculation, or strict route sequencing for a massive fleet of vehicles, InstaMaps is not a replacement for enterprise logistics software. Paid Transport Management Systems (TMS) pull live road data and optimise for current traffic patterns. InstaMaps bridges the gap for teams that need quick, accessible spatial awareness directly within their spreadsheets without purchasing complex software licenses.

Try it free

Map your Salesforce accounts in under 5 minutes — no admin setup.

Install Free →

Common Questions

How do I calculate driving distances for a list of address pairs in a spreadsheet?

Put the start addresses in column A and the destinations in column B, enter =DISTANCE(A2, B2, "mi") in C2 and fill it down: each row gets the road distance for its pair. =TRAVEL_TIME(A2, B2) beside it gives the drive time in minutes. Both come with the free InstaMaps add-on for Google Sheets™.

Can Google Sheets calculate distance between two addresses?

No, Google Sheets cannot calculate distance natively. You must install a third-party add-on like InstaMaps from the Google Workspace Marketplace to access custom formulas such as =DISTANCE() that perform these mathematical calculations.

How do I measure distance in Google Sheets?

Once the InstaMaps add-on is installed, input =DISTANCE(A2, B2) into a cell, replacing A2 and B2 with the cells containing your addresses. The add-on will output the measurement in your specified unit of measurement.

Does the distance formula measure road miles?

Yes. =DISTANCE() returns the distance by road by default, the miles a car actually drives, without live traffic. Add "straight" as the fourth argument for the straight-line distance: =DISTANCE(A2, B2, "mi", "straight").

How do I sort addresses by distance in Google Sheets?

You can use the InstaMaps add-on and input the =SORT_BY_DISTANCE(target, range) formula. This automatically reorders a list of addresses based on which location is physically closest to your specified target address.

Start calculating distances in your spreadsheets

Install InstaMaps for free to measure spatial gaps, find your closest locations, and map your spreadsheet data without leaving Google Sheets.

Install InstaMaps free
Address and map data © OpenStreetMap contributors.