Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (2024)

If you have a long list of geographic coordinates to work with, a Microsoft Excel spreadsheet is sure to be useful. There are three basic Excel tools that can work for you, no matter how you want to manipulate your geographic coordinates. You’ll need to know how to calculate the distance between two latitude and longitude points, how to convert latitude and longitude data to decimal degrees, and finally, how to geocode latitudes and longitudes.

How to Calculate the Distance Between Two Coordinates in Excel

In an example of how to calculate the distance between two coordinates in Excel, we’ll seek to measure the great circle distance. We’ll note that latitude and longitude are denoted in degrees, minutes and seconds.

Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (1)

Convert Latitude and Longitude to Decimal Degrees in Excel

Everything, including something as complicated as degrees, minutes, and seconds, can be converted into decimals. The degrees part remains the same, but minutes and seconds need to be converted into their percentage of a degree and combined. There are 60 minutes in a degree and 60 seconds in a minute (which means 3,600 seconds in a degree). Therefore, divide minutes by 60 and seconds by 3,600.

The overall formula:

Total Degrees (in the decimal form) = Deg + [Mins / 60] + [Seconds / 3600]

Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (2)

…So About That Distance

Now that you have the latitude and longitude values in decimals, you just face the equation for the nautical miles between Timbuktu and Casablanca, noted underneath.

Nautical Miles= ACOS [(sin(Lat_place_1*PI()/180)*sin(Lat_place_2*PI()/180)+

cos(Lat_place_1*PI()/180)*cos(Lat_place_2*PI()/180)*

cos(Lon_place_2*PI()/180-Lon_place_1*PI()/180))] *3443.8985

That three thousand number, in the end, is the radius of Earth, in, Nautical Miles. Even if you were to substitute it with the radius of a sphere, assuming the Earth is spherical, at 3437.7468 NM, you will not be near the real, accurate distance.

Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (3)
Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (4)

Geocode Latitude and Longitude in Excel

Geocoding is the conversion of street addresses to latitude and longitude data that can be mapped. Now, there are two ways to geocode latitude and longitude from an Excel spreadsheet: the hard way and the easy way.

We’ll cover the hard way first, which is what you’ll need if you require the coordinates to live in your Excel document. You’ll need to write the Visual Basic (VBA) script to make a call to an external geocoder, or find the code elsewhere, such as this GitHub repo. There are a number of geocoder APIs and some geocoders are faster than others.

The Google Maps Geocoding API is a common choice and this is the API we’ll call in the easy option. However, it also can work directly within Excel. Armed with the code you’ve written or discovered, here are the steps to deploy geocoding within Excel.

Step 1: Find the Developer tab in your version of Excel.

Step 2: Look for the “Visual Basic” tab. This opens the development window.

Step 3: Insert —> Module. The new module will hold your function.

Step 4: Here is where you copy and paste your code.

Step 5: We need to add references now. So, Tools —> References. Make sure to check the Microsoft XML v6.0. CLICK OK.

Step 6: Press CTRL / CMD + S. Save as type —> Excel Add-In. Now you get to name your function. The extension has to be .xlam. Time to close all Excel files.

Step 7: Open a new file. File —> Options —> Add-Inns. In the Manage box, choose Excel-Add Ins.

Step 8: Press Go. Choose your function in the window that appears by ticking in the box. Press OK.

Step 9: VOILA. Now you could just use the new function you created, like any other function.

After you are done retrieving the values, copy and paste them elsewhere, off of the sheet with the calculations. Then delete the function calls because otherwise when you reopen this file, the Google API will start to be pinged again. That will eat up several minutes before the file is open. To optimize Google resource usage, take a 10-second break between addresses.

That’s a lot of steps, and assumes you’ve found some code to try out. Next, we’ll see the easier way to geocode your Excel data. It’s fast and reliable, but it won’t import the coordinates into your Excel file. On the other hand, the excel geocoding tool is copy-paste simple and gets you an interactive map.

Create a Map with Excel

There are a number of ways to create maps with Excel data. Perhaps the easiest is to just copy and paste your spreadsheet data into our map-making tool. Doing so turns your Excel document into a beautiful, interactive map like the one below.

View Example Latitude/Longitude Map in a full screen map

To make your own map based on latitude and longitude coordinates, separate the coordinates into their own columns within your spreadsheet.

Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (5)
Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (6)
Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (7)

Then, select and copy the rows and columns of your spreadsheet (Ctrl+C command or Cmd+C on Mac) and navigate to batchgeo.com. Paste (Ctrl+V or Cmd+V on Mac) in your data, and you’re done!

Whether you want to make a latitude and longitude map or create your own virtual wedding guide for your guests, BatchGeo provides a free and easy way to make beautiful web maps that are ready to be saved and shared.

Latitude and Longitude in Excel: Calculate Distance, Convert Degrees, and Geocode Addresses - BatchGeo Blog (2024)
Top Articles
The Unforeseen Guest Episode 15
Craigslist.org Fairbanks
Craigslist St. Paul
Uti Hvacr
Craigslist Benton Harbor Michigan
Craglist Oc
Senior Tax Analyst Vs Master Tax Advisor
Pickswise the Free Sports Handicapping Service 2023
Nm Remote Access
2022 Apple Trade P36
Kostenlose Games: Die besten Free to play Spiele 2024 - Update mit einem legendären Shooter
How to Watch Braves vs. Dodgers: TV Channel & Live Stream - September 15
Vocabulario A Level 2 Pp 36 40 Answers Key
Infinite Campus Parent Portal Hall County
Olivia Ponton On Pride, Her Collection With AE & Accidentally Coming Out On TikTok
Hallelu-JaH - Psalm 119 - inleiding
8 Ways to Make a Friend Feel Special on Valentine's Day
Aspen.sprout Forum
Oro probablemente a duna Playa e nomber Oranjestad un 200 aña pasa, pero Playa su historia ta bay hopi mas aña atras
Ms Rabbit 305
Finalize Teams Yahoo Fantasy Football
Iu Spring Break 2024
Euro Style Scrub Caps
Apartments / Housing For Rent near Lake Placid, FL - craigslist
55Th And Kedzie Elite Staffing
Bayard Martensen
Cylinder Head Bolt Torque Values
Movies - EPIC Theatres
Visit the UK as a Standard Visitor
Mini-Mental State Examination (MMSE) – Strokengine
Ringcentral Background
APUSH Unit 6 Practice DBQ Prompt Answers & Feedback | AP US History Class Notes | Fiveable
Taktube Irani
Brenda Song Wikifeet
Otis Offender Michigan
Miss America Voy Board
Jay Gould co*ck
Bratislava | Location, Map, History, Culture, & Facts
What Time Does Walmart Auto Center Open
Tendermeetup Login
Agematch Com Member Login
Craigslist Boats Eugene Oregon
How to play Yahoo Fantasy Football | Yahoo Help - SLN24152
Jaefeetz
Gary Vandenheuvel Net Worth
UWPD investigating sharing of 'sensitive' photos, video of Wisconsin volleyball team
Sandra Sancc
Euro area international trade in goods surplus €21.2 bn
Rovert Wrestling
Shiftselect Carolinas
17 of the best things to do in Bozeman, Montana
Jesus Calling Oct 6
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 5331

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.