Excel Distance Formula: Calculate Distances with Ease

Montreal Jul 09, 2026

Calculating distance in Excel can be a breeze with the right formula. Whether you're measuring distance between cells or geographical coordinates, Excel's built-in functions can handle it all. Let's dive into the formulas you need to know to become a distance-calculating pro in Excel.

How to Calculate Driving Distance between Two Addresses in Excel
How to Calculate Driving Distance between Two Addresses in Excel

Before we get started, ensure your Excel version supports these formulas. Most recent versions do, but it's always a good idea to check. Now, let's explore the formulas under two main topics: calculating distance between cells and measuring geographical distance.

How to Calculate Distance Between Two Addresses in Excel (3 Ways)
How to Calculate Distance Between Two Addresses in Excel (3 Ways)

Calculating Distance Between Cells

To calculate the distance between two cells in Excel, you can use the NETWORKDAYS function, which is designed to calculate the number of working days between two dates. However, it can also calculate the number of days between any two numbers, making it perfect for our purpose.

How to Calculate Distance between Two GPS Coordinates in Excel
How to Calculate Distance between Two GPS Coordinates in Excel

Here's the formula: =NETWORKDAYS(start_cell, end_cell). Replace start_cell and end_cell with the references to your cells. For example, if your start cell is A1 and your end cell is B1, your formula would look like this: =NETWORKDAYS(A1, B1).

Using NETWORKDAYS with Non-Date Values

How to Calculate Coordinates from Bearing and Distance in Excel
How to Calculate Coordinates from Bearing and Distance in Excel

If your cells contain non-date values, you can still use the NETWORKDAYS function. Excel will treat these values as dates, but you'll need to format the cells as dates for the function to work correctly. To do this, select the cells, click on the 'Number' group under the 'Home' tab, and then click on 'Format as Table'. In the 'Format Cells' dialog box, select 'Date' and choose a date format.

Once your cells are formatted as dates, the NETWORKDAYS function will work as expected, giving you the number of days (or any other unit you're measuring) between the two cells.

Calculating Distance with Leap Years

Top 21 Excel Formulas
Top 21 Excel Formulas

If you're calculating distance in years and want to account for leap years, the NETWORKDAYS function is your friend. It automatically excludes weekends and considers leap years, making it an accurate tool for calculating distance over time.

For example, if you want to calculate the distance in years between two dates, you can use the following formula: =NETWORKDAYS(A1, B1)/365.25. This formula divides the number of days by 365.25 to account for leap years. The result will be the distance in years between the two dates.

Measuring Geographical Distance

17 Speed Formula Worksheet
17 Speed Formula Worksheet

To calculate the geographical distance between two points, you can use the Haversine formula, which calculates the shortest distance between two points on the surface of a sphere. In Excel, you can use the MOD and SQRT functions to implement this formula.

Here's the formula to calculate the distance in kilometers between two points given their latitudes and longitudes: =2 * 6371 * ASIN(SQRT(SIN((lat2-lat1)/2)^2 + COS(lat1) * COS(lat2) * SIN((lon2-lon1)/2)^2)).

ms excel formula
ms excel formula
Time Speed Distance Triangle Formula Chart | Easy Learning Guide
Time Speed Distance Triangle Formula Chart | Easy Learning Guide
the top 26 excel formulas are displayed in this screenshoter's guide
the top 26 excel formulas are displayed in this screenshoter's guide
how to create a sum formula in excel and wordpress - infographical poster
how to create a sum formula in excel and wordpress - infographical poster
Excel Formulas: Basic to Advanced
Excel Formulas: Basic to Advanced
a table with numbers and symbols on it, in the form of a bar chart
a table with numbers and symbols on it, in the form of a bar chart
11 Distance Formula Worksheet
11 Distance Formula Worksheet
Exel Formulas
Exel Formulas
the top 2 excel formulas are shown in this poster, and it is also available for
the top 2 excel formulas are shown in this poster, and it is also available for
How to Calculate the Percentage in Excel (Formula)
How to Calculate the Percentage in Excel (Formula)
a poster describing speed, time and distance for students to learn how to use it
a poster describing speed, time and distance for students to learn how to use it
Excel Formulas You Should Know
Excel Formulas You Should Know
the top 20 new excel formulas are displayed in this screenshoter's image
the top 20 new excel formulas are displayed in this screenshoter's image
the basic guide to excelif formulas for beginners and advanced students in english
the basic guide to excelif formulas for beginners and advanced students in english
Excel Sum Formula Examples, Excel Sum Formula Guide, Excel Spreadsheet Learning, Excel For Business Data Management, Excel Spreadsheet Formulas, Excel For Business Management, How To Assign Serial Numbers In Excel, Excel Spreadsheet Skills, Excel Sumproduct Guide
Excel Sum Formula Examples, Excel Sum Formula Guide, Excel Spreadsheet Learning, Excel For Business Data Management, Excel Spreadsheet Formulas, Excel For Business Management, How To Assign Serial Numbers In Excel, Excel Spreadsheet Skills, Excel Sumproduct Guide
Excel Formulas
Excel Formulas
a poster with instructions for how to use formula fast in excel, pro tip and hidden templates
a poster with instructions for how to use formula fast in excel, pro tip and hidden templates
Excel Formula Mistakes Beginners Should Avoid
Excel Formula Mistakes Beginners Should Avoid
Learn Excel IF and Then Formula - 5 Tricks you didnt know
Learn Excel IF and Then Formula - 5 Tricks you didnt know
See Every Formula Fast in Excel
See Every Formula Fast in Excel

Using the Haversine Formula in Excel

In this formula, lat1 and lon1 represent the latitude and longitude of the first point, while lat2 and lon2 represent the latitude and longitude of the second point. The formula uses radians, so you don't need to convert your degrees to radians before using it.

Here's how you can use this formula in Excel. Suppose you have the following coordinates in cells A1 and B1 for the first point (latitude and longitude), and in cells C1 and D1 for the second point. Your formula would look like this: =2 * 6371 * ASIN(SQRT(SIN((D1-A1)/2)^2 + COS(A1) * COS(D1) * SIN((B1-C1)/2)^2)).

This formula will give you the distance in kilometers between the two points. If you want the distance in miles, you can multiply the result by 0.621371.

Now that you know how to calculate distance in Excel, you're ready to tackle any distance-related challenge that comes your way. Happy calculating!