Why Excel Does Not Have a Built-In Miles Function (And How to Add It)
Question details
The user is attempting to calculate travel distance using a 'Miles' function they used previously, but is unable to find it in their current spreadsheet software.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Trying to calculate driving distances or travel mileage between different cities or states directly within a spreadsheet.
- Observed behavior
- The '=Miles()' function is unrecognized, typically resulting in a #NAME? error, because it is not a native feature of the software.
Before troubleshooting, note that the 'Miles' function is not a standard built-in formula. Confirm if your previous organization utilized third-party logistics add-ins (such as PC*Miler) to enable this calculation.
Install and Activate a Third-Party Mileage Add-in
Since the function is not native, you must install the specific third-party add-in (like PC*Miler or a custom logistics tool) that provides the distance calculation feature.
Many organizations purchase custom enterprise tools to calculate routing distances. Upgrading your Office subscription will not add this function natively.
You will need to download the installation file from the add-in provider or contact your company's IT department to request the software.
Launch your spreadsheet and navigate to 'File' in the top-left corner, then click on 'Options'. Select 'Add-ins' from the left-hand sidebar.
Review the list of 'Inactive Application Add-ins' to see if a logistics tool is already installed but disabled. If it is not listed, you must install the third-party software first.
At the bottom of the window, ensure the 'Manage' dropdown is set to 'Excel Add-ins' and click 'Go'. Check the box next to your mileage add-in and click 'OK' to activate the custom Miles function.

Use a Custom VBA Macro and Web API Alternative
If you cannot purchase an enterprise mileage add-in, you can use a custom VBA script paired with a mapping API to calculate distances.
Try WPS Office for Your Data Analysis and Spreadsheets
While highly specialized third-party logistics add-ins like PC*Miler are required for instant mileage routing, WPS Office provides a powerful, fast, and completely free alternative for all your standard spreadsheet operations, formulas, and data management tasks.
- 1. Download the Installer: Visit the official WPS website to download the free installer for Windows, Mac, or Linux.
- 2. Run the Installation: Open the downloaded file and follow the on-screen prompts to complete the rapid installation.
- 3. Open Your Workbooks: Launch WPS Spreadsheets and easily open your existing Excel files to continue your data analysis without formatting loss.

Frequently Asked Questions
Does upgrading to a higher Microsoft 365 tier add the Miles function?
No. The 'Miles' function is not a native Microsoft feature. Upgrading your subscription will not automatically provide this function; it must be installed via a third-party add-in.
Why does my cell show a #NAME? error when I type =Miles()?
The #NAME? error appears because the spreadsheet application does not recognize the function name. This confirms that the required mileage add-in is either not installed or currently disabled on your device.
Can I calculate the distance between zip codes without a paid add-in?
Yes, but it requires workarounds. You can use a VBA script combined with a free mapping API, or import web data using Power Query to scrape distances from routing websites manually.




