In our day to day life, we feel the necessity of **measuring distance** in so many times. It is not so tough to **calculate the distance between two GPS coordinates in Excel**. I am going to elaborate 2 simple ways to **calculate the distance between two GPS coordinates in Excel**.

For more clarification, I will use a dataset comprisingÂ the **Latitude **and Longitude values of the locations **Prague, Czech Republic**, and **Salzburg, Austria**.

**Table of Contents**hide

## Download Practice Workbook

## 2 Simple Ways to Calculate Distance between Two GPS Coordinates in Excel

### 1.Â Using Arithmetic FormulaÂ to Calculate Distance between Two GPS Coordinates

The use of the arithmetic formula is the quickest and simplest way to **calculate the distance between two GPS coordinates**. Now, follow the following steps for this purpose.

**Steps**:

- Create a new row titled
**Distance (Miles)**. - Select a cell to apply the following formula:

`=ACOS(COS(RADIANS(90-C5))*COS(RADIANS(90-C6))+SIN(RADIANS(90-C5))*SIN(RADIANS(90-C6))*COS(RADIANS(D5-D6)))*3959`

Here,

- The
**Radian Function**converts the value in**Degree**units into a value of**RadianÂ**unit. - The
**ACOS Function**returns the inverse cosine of a number.

**Formula Breakdown**

**COS(RADIANS(90-C5))*COS(RADIANS(90-C6))+SIN(RADIANS(90-C5))*SIN(RADIANS(90-C6))*COS(RADIANS(D5-D6)) **â€“ this portion provides the value using trigonometry operators.**Output: **0.999092512926254

**ACOS(0.999092512926254) **â€“ **ACOS Function **returns the inverse Cosine value.**Output: **0.0426057358212635

**0.0426057358212635 *3959 **â€“ The multiplication of **3959 **converts the value into **Miles**.**Output: **168.676108116382

- Finally, press
**ENTER**to have the result.

Thus, we can **calculate the distance between two GPS coordinates **quite easily.

**Read More: ****How to Calculate Distance Between Two Cities in Excel**

### 2. Using VBA to Calculate Distance between Two GPS Coordinates

We can also use **VBA **to **calculate the distance between two GPS coordinates**. It is the smartest way to do so.

**Steps**:

- First of all, go to the
**DeveloperÂ**tab. - Choose
**Visual Basic**from the ribbon.

- Now, click on
**Insert**. - Then, press on
**Module**.

- Now, Input the following VBA code in the empty space:

```
Public Function DistCalc(Prague_Lati As Double, Prague_Longi As Double, Salzburg_Lati As Double, Salzburg_Longi As Double)
Â Â Â With WorksheetFunction
Â Â Â Â Â Â Â M = Cos(.Radians(90 - Prague_Lati))
Â Â Â Â Â Â Â N = Cos(.Radians(90 - Salzburg_Lati))
Â Â Â Â Â Â Â O = Sin(.Radians(90 - Prague_Lati))
Â Â Â Â Â Â Â P = Sin(.Radians(90 - Salzburg_Lati))
Â Â Â Â Â Â Â Q = Cos(.Radians(Prague_Longi - Salzburg_Longi))
'Change 6371 to 3959 to get your result in Miles
Â Â Â Â Â Â Â DistCalc = .Acos(M * N + O * P * Q) * 6371
Â Â Â End With
End Function
```

Firstly, I used here a Public Function procedureÂ **DistCalc**. Then, I set some variables **M, N, O, P, **and **Q** with certain values. I mentioned a suitable relation between the variables to define theÂ **DistCalcÂ **Function.

- Now, select a cell to have the measured result (i.e.
**C8**). - Now, apply the following formula:

`=DistCalc(C5,D5,C6,D6)`

Here, the **DistCalc function **estimates the **distance between the two points**.

- Finally, hit
**ENTER**.

This is the coolest way to **calculate the distance between two GPS coordinates**.

**Read More: ****How to Calculate Distance Between Two Addresses in Excel (3 Ways)**

## Practice Section

You can practice here for more expertise.

## Conclusion

In this article, I have tried to articulate 2 simple ways to **calculate the distance between two GPS coordinates in Excel**. I hope it will be helpful for all. For any further questions, comment below.

## Related Articles

**Calculate Driving Distance between Two Addresses in Excel****How to Calculate Coordinates from Bearing and Distance in Excel****Calculate Mahalanobis Distance in Excel (Step by Step)****How to Calculate Miles between Two Addresses in Excel (2 Methods)****Calculate Manhattan Distance in Excel (2 Suitable Ways)****How to Calculate Levenshtein Distance in Excel (4 Easy Methods)**