BlogReference

=VISIT_ORDER() — Optimize Visit Order in Google Sheets

6 July 2026·8 min read

To optimise visit order in Google Sheets, install the InstaMaps add-on and use the =VISIT_ORDER() function. Provide a range of addresses and a starting point; the formula returns the most efficient driving sequence, eliminating manual routing. It processes stops directly within your spreadsheet.

This is for field sales reps coordinating a 200-home farm, and dispatch managers scheduling 5 crews across 47 daily stops. The end state is a sorted sheet that cuts driving time and feeds directly into navigation links, letting you dispatch teams without leaving Google Sheets.

TL;DR
  • =VISIT_ORDER(locations, [start_location]) sorts a list of addresses into the most efficient driving sequence.
  • It returns a comma-separated string of addresses, optimised for the shortest practical driving route.
  • Use the InstaMaps sidebar (Extensions > InstaMaps > Enable formulas) to insert this formula without typing.
  • The free tier allows 100 lookups/day (1,000/day with a free email unlock).
  • Combine with =ROUTE_LINK() to generate a Google Maps URL (maximum 11 stops per link).
  • Combine with =INSTAMAP() to view the optimised route on a live, shareable map URL.

Syntax and Arguments

=VISIT_ORDER(address_range, [start_address], [travel_mode])

The function outputs a spilled array of addresses in an optimised sequence. If you receive a #NAME? error, the InstaMaps add-on is not installed, or you have mistyped the function name. The add-on is free, and processing counts against your daily quota (100 lookups/day on the free tier, 1,000/day with a free email unlock). A route with 10 stops consumes 10 daily lookups.

  1. address_range (required): The vertical range of cells containing standard addresses (e.g. A2:A50) or coordinate pairs (e.g. F2:F50). The range must be strictly one-dimensional; two-dimensional ranges return a #VALUE! error.

  2. start_address (optional): A single cell reference (e.g. B1) or a text string (e.g. "120 Park Avenue, London") defining the route's origin. If omitted, the function defaults to the first row in the address_range.

  3. travel_mode (optional): Determines the road network logic used for distance calculations. Accepts "driving" (default), "walking", or "cycling". Using "walking" calculates pedestrian routes, ignoring motorway restrictions.

How to Apply the Formula

You can insert =VISIT_ORDER() manually or generate it automatically using the InstaMaps sidebar. Manual entry is useful for quick, ad-hoc routing, while the sidebar workflow builder handles heavy data processing without typos.

  1. Manual entry: Click the cell where you want the ordered list to spill downward. Ensure the rows below are empty to prevent a #REF! error. Type =VISIT_ORDER(A2:A50, B1, "driving") and press Enter.

  2. Sidebar entry: Navigate to Extensions > InstaMaps > Enable formulas to open the add-on interface.

  3. Highlight your raw address data in column A.

  4. Click the Build-the-workflow button in the sidebar.

  5. Select 'Optimise Visit Order' from the routing dropdown menu.

  6. The sidebar scripts write the =VISIT_ORDER() formula into the adjacent empty column B, automatically locking your highlighted range (e.g. $A$2:$A$50) to prevent cell drift.

Worked Examples

Scenario 1: Door-knocking a 200-home farm. A local political campaign possesses a list of 200 targeted voters in a specific neighbourhood. Walking door-to-door randomly wastes volunteer hours. The campaign manager pastes the 200 addresses into column A (cells A2:A201). They place the local campaign office address in cell C1 as the starting point. Using =VISIT_ORDER(A2:A201, C1, "walking") in cell D2, the function calculates the most efficient pedestrian path. It outputs a spilled array of 200 addresses in column D, ordered from the nearest door to the furthest. Because it uses the "walking" parameter, the sequence cuts through pedestrian pathways and parks rather than mapping a one-way driving loop.

Scenario 2: Dispatching 5 crews to 47 stops. A fibre installation company needs to dispatch 5 technicians to 47 scattered service appointments. The dispatcher filters the data and splits the 47 addresses into 5 distinct sheets based on postcode zones, resulting in roughly 9-10 addresses per sheet. In the first crew's sheet, the dispatcher enters =VISIT_ORDER(A2:A11) in cell C2. The function calculates the optimal driving sequence, rearranging the 10 stops into the fastest route. If a new ticket arrives, the dispatcher types the address into row 12, updates the range to A2:A12, and the route recalculates instantly. This allows the dispatcher to assign the first 5 stops in the ordered array to the technician for the morning shift.

Scenario 3: Mapping a 10-stop delivery route. An independent baker delivers pastries to 10 cafes across the city. She lists the 10 addresses in cells A2:A11 and her bakery location in A1. She enters =VISIT_ORDER(A2:A11, A1) in cell B2. The function instantly generates a 10-stop sequence in column B, spilling down to B11. Because this is exactly at the 10-stop threshold, she can pair this ordered list with the =ROUTE_LINK() function to generate a single Google Maps URL. The formula calculates the sequence based on current road conditions, clustering stops geographically to minimise backtracking.

Composes With

InstaMaps formulas chain together to build automated routing workflows without writing Apps Script. The =VISIT_ORDER() function passes a perfectly sorted array of addresses directly into navigation and visualisation functions, reducing manual copy-pasting.

Chain 1: Nesting inside ROUTE_LINK. If you are routing 10 or fewer stops, you can pass the optimised array directly into =ROUTE_LINK(). This generates a clickable navigation URL using Google Maps' official URL scheme (max 11 stops), which opens directly in the Google Maps app on a mobile device. Formula structure: =ROUTE_LINK(VISIT_ORDER(A2:A11, A1)). Behaviour: The formula first arranges the 10 stops in A2:A11 starting from the depot in A1. It then converts that specific sequence into a single URL. You click the cell, and your phone opens with turn-by-turn directions for the exact optimised route.

Chain 2: Nesting inside INSTAMAP. For larger routes or team visibility, nest the ordered array inside =INSTAMAP(). This generates a live, hosted shareable map URL that updates when the sheet changes. Formula structure: =INSTAMAP(VISIT_ORDER(A2:A50, A1)). Behaviour: The function takes the 49 optimised stops from A2:A50, plots them on a web-hosted map in their logical sequence, and outputs a secure URL. When new addresses are added to the address_range, the =VISIT_ORDER() recalculates, and the =INSTAMAP() hosted link automatically refreshes to show the updated pins. You can share this URL with a driver who only needs to view the map interface. Templates combining these exact routing functions are available at get-instamaps.com/templates.

Common Errors

Error: #NAME? in the cell.

Cause: Google Sheets does not recognise the =VISIT_ORDER() text as a custom function. This occurs when the InstaMaps add-on is not installed in the active document, or if the background script lacks the authorisation to run. Sheets defaults to a standard text string and throws a #NAME? error when it cannot resolve the instruction.

Resolution: Install the free InstaMaps add-on. If it is already installed, navigate to Extensions > InstaMaps > Enable formulas. Click the cell containing the error, double-click to enter edit mode, and press Enter to re-trigger the script permission prompt. If the syntax is incorrect or the add-on is missing, Google Sheets flags it. You can read more about resolving custom function failures in our google-sheets-geocode-formula troubleshooting guide.

Error: #QUOTA_EXCEEDED!

Cause: You have surpassed the daily lookup limit. The standard free tier provides 100 lookups per day. Registering your account with a free email unlock raises this capacity to 1,000 lookups per day.

What happens: When you execute =VISIT_ORDER(A2:A150, B2:B150), the add-on reads the coordinates for 149 addresses to calculate the most efficient driving sequence. If your account is already at 900 lookups for the day, the function processes the first 100 addresses, hits the 1,000 cap, and halts the operation. The cell returns the quota error string.

Resolution: Check your daily usage in the InstaMaps sidebar. You must wait until midnight Pacific Time for the quota to reset, or reduce your target range. Test your route logic on a smaller batch, such as =VISIT_ORDER(A2:A11, B2:B11), to verify the output without burning through your remaining daily quota.

Limits and Honest Alternatives

=VISIT_ORDER() rearranges a list of coordinates into the most efficient driving sequence. However, how you push that sequence to a driver relies on =ROUTE_LINK(), which builds URLs using Google Maps' official URL scheme. Google Maps enforces a hard cap of 11 stops per generated URL. If you run =VISIT_ORDER(A2:A50, B2:B50) to optimise 49 stops, the output array succeeds. But if you pass those 49 optimised rows directly into =ROUTE_LINK(), the resulting hyperlink truncates everything after the 11th stop. It is a strict parameter limit imposed by Google's web interface.

If you have a 47-stop route, you must chunk your data. Split the optimised output into five batches of 10 rows, and generate five distinct =ROUTE_LINK() URLs. The driver opens a new link as they complete each batch. For visual planning across all 47 points, =INSTAMAP(A2:A50) handles the volume simultaneously by generating a live, hosted shareable map URL that updates when the sheet changes. This visual map does not face the 11-stop cap, but it does not provide turn-by-turn navigation.

If you manage 5 dispatch crews handling 200 stops per day, a spreadsheet environment cannot sustain the routing workload. Enterprise logistics requires dynamic traffic re-routing, driver telemetry, and multi-vehicle optimisation algorithms. For this scale, abandon Google Sheets and adopt dedicated routing platforms like Routific, Onfleet, or OptimoRoute. InstaMaps is built for single-vehicle route optimisation, territory planning, and dispatch queues under 50 stops.

Who This is For

This function is built for operators who need sequential routing without exporting their database into standalone mapping software.

  1. Field sales canvassers: Representatives working a 200-home farm. If you knock on 30 doors a day, =VISIT_ORDER(A2:A31, B2:B31) sequences your stops so you minimise driving time between neighbourhoods. You pair it with =WAZE_LINK() to push the next destination to your phone.

  2. Local delivery dispatchers: Solo drivers handling 40 daily drops. You use =VISIT_ORDER() alongside =DISTANCE_MATRIX() to verify that the optimised sequence stays within an 8-hour shift window and calculates accurate fuel reimbursements.

  3. Real estate agents: Agents scheduling 6 to 8 property viewings in a single afternoon. The formula prevents zig-zagging across a county, ensuring you arrive at consecutive listings on time.

  4. This tool is not for enterprise fleet managers who require live GPS tracking and satellite traffic overlays. It is for spreadsheet-first users who need a mathematically sound shortest path for a manageable list of physical locations.

Try it free

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

Install Free →

Common Questions

How do I optimize visit order in Google Sheets?

Use the =VISIT_ORDER() function to sort a list of addresses into an efficient driving sequence based on a specified starting point. Syntax: =VISIT_ORDER(locations, start_location) Arguments: locations: The range of cells containing addresses or coordinates (e.g., A2:A50). start_location: The specific address or coordinate pair where the route begins (e.g., B1). Worked Example 1 (Door-knocking): A field sales rep has a 200-home farm and needs to visit 15 homes today. In column A (A2:A16), they list the target addresses. In cell B1, they enter their starting office address. They run =VISIT_ORDER(A2:A16, B1) to output a comma-separated list of the most efficient visiting order.

Is there a Google Sheets formula to sort addresses by the fastest driving route?

Yes, =VISIT_ORDER() is the specific formula designed to sort addresses by the most efficient driving route, factoring in actual road layouts rather than straight-line distance. Worked Example 2 (Dispatch): A local delivery dispatcher has 12 stops for a single vehicle. The addresses are in C2:C13. The depot postcode is in F1. By entering =VISIT_ORDER(C2:C13, F1), the dispatcher gets an optimised sequence. They can then use this output to organise loading docks and driver manifests.

What is the maximum number of stops for =VISIT_ORDER in InstaMaps?

The maximum number of stops you can process in a single =VISIT_ORDER() request is 15. This aligns with the limits of mapping APIs for quick, browser-based calculations without causing sheet timeouts. Limits and honest alternatives: If you have a list of 47 daily stops, you cannot process them all at once. You must break the list into smaller chunks (e.g., =VISIT_ORDER(A2:A16, B1), then =VISIT_ORDER(A17:A31, A16)). Alternatively, you can use the =SORT_BY_DISTANCE() function for a simpler nearest-neighbour sort of the entire 47-row list, though it will not account for actual road driving times like VISIT_ORDER does.

Why does my Google Sheet show a #NAME? error for VISIT_ORDER?

A #NAME? error indicates that Google Sheets does not recognise the function, which happens when the InstaMaps add-on is not installed or enabled. You must install InstaMaps from the Google Workspace Marketplace and ensure the sidebar is open via Extensions > InstaMaps > Enable formulas. For more details on setting up the environment correctly, see our guide on the [google-sheets-geocode-formula](google-sheets-geocode-formula). If the add-on is installed but you see a quota message, you have exceeded the free tier limit of 100 lookups per day.

Can I create a Google Maps route link from an optimised list of addresses?

Yes. =VISIT_ORDER() composes effectively with mapping functions to turn raw data into actionable navigation. Worked Example 3 (Sales territory): A territory manager builds a workflow. They first use =VISIT_ORDER(A2:A12, B1) in cell D1 to get the optimal stop sequence. Next, they pass that sequence into =ROUTE_LINK(D1), which outputs a clickable Google Maps URL using Google's official URL scheme (which supports a maximum of 11 stops). Finally, they use =INSTAMAP(A2:A12) to generate a live, hosted map URL that visualises the pins and updates automatically when the sheet changes.

How many route optimisations can I run per day on the free tier?

The free tier permits 100 lookups per day. A single =VISIT_ORDER() calculation counts as one lookup against this quota. If you need to run optimisations across larger datasets or multiple dispatch sheets, you can increase your limit to 1,000 lookups per day with a free email unlock. You can also insert formulas without typing by using the InstaMaps sidebar, where the Build-the-workflow button writes whole chains for you. Pre-built templates are available at get-instamaps.com/templates.

Stop manually sorting routes

Calculate efficient driving sequences and generate live maps directly in your spreadsheet.

Install InstaMaps free