TRAVELDISTANCE Function – Google Sheets

TRAVELDISTANCE helps spreadsheet users plan trips by finding the distance between two points. This function can calculate the distance for hundreds of address pairs in seconds.

❗This custom function is only available to users of the Travel Formulas add-on from the Google Workspace Marketplace. Travel Formulas uses Google Maps for you while you stay in your spreadsheet.

Purpose

The TRAVELDISTANCE function returns the distance between locations.

All Travel Formulas

TRAVELTIME – Returns the trip duration between locations

TRAVELDISTANCE – Finds the trip distance between locations

TRAVELROUTEURL – Returns the link to your route in Google Maps™

TRAVELDIRECTIONS – Provides turn-by-turn directions

Syntax

=TRAVELDISTANCE(origin, destination, mode, unit)

origin – The starting location

destination – The ending location

mode – The mode of travel (“driving”, “walking”, “bicycling”, “transit”) [optional, defaults to driving]

unit – The unit of distance (“mi”, “km”) [optional, defaults to miles]

Examples

Example 1 – Two Addresses

Let’s keep it simple at first and use two cities: one for the origin and the other for the destination.

The TRAVELDISTANCE formula finding the distance between New York and Los Angeles
Two Addresses

These locations are just a bit oversimplified. But if Google Maps accepts them, the formulas work! The trip from New York to Los Angeles turns out to be way too long at 2,790 miles.

This function accepts direct input such as “NY” but can also use cell references. We’ll switch to using cell references for the following examples, as they give us more flexibility.

Example 2 – Different Modes

We can evaluate driving, mass transit, biking, and walking. These mileages can be significantly different within the same city. Let’s travel through Chicago using these different modes.

The TRAVELDISTANCE function calculating distance with different modes of transportation
Different Modes of Travel

A bike ride is the same distance as driving, while you can take some shortcuts if you walk and save two miles.

Example 3 – Different Units

Let’s say you’re an American but want to use a more logical measurement unit. You can change the formula to use kilometers.

The TRAVELDISTANCE formula with miles and kilometers
Different Units

Now, our non-American friends can enjoy some measurements, too.

Example 4 – Different Location Formats

You don’t have to use a city name or full address. Other geolocation methods, such as Plus codes and coordinates, also work, as shown below.

Different Location Formats

Rows 2 through 6 in the image above use the same locations but different methods to specify them. You can use a city name, a full address, a placename, plus code, or even latitude and longitude.

Conclusion

The TRAVELDISTANCE formula is a versatile tool that helps you plan your trips without leaving Google Sheets.