Can you get the county for latitude and longitude with a macro

dee101

Active Member
Joined
Aug 21, 2004
Messages
272
I have Latitude in cell I3 and Longitude in cell J3 in decimal degrees like this 34.40561111 -83.21211111 is there a way to get the county from the coordinates and put it in cell K3? In this case it would be Franklin.

This will be for coordinates in the US only if that makes any difference and I will be using this with Excel 2003.
Thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,851
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I don't know about 2003, (it would work with 2010) you should check out the MapQuest API. You can get a free KEY for 15,000 transactions a month. With the key you should be able to do a "WinHttpRequest to return a CSV which can be parsed into your spreadsheet. Something like this:

Code:
url = https://www.mapquestapi.com/geocoding/v1/reverse?key=[COLOR=#ff0000]KEY[/COLOR]&location=34.40561111%2C-83.21211111&outFormat=csv&thumbMaps=false&delimiter=%2C

would return a CSV like this:

"Country","State","County","City","PostalCode","Street","Lat","Lng","DragPoint","LinkId","Type","GeocodeQualityCode","GeocodeQuality","SideOfStreet","DisplayLat","DisplayLng"
"US","GA","Franklin","Martin","30557-4176","860 Baty Rd","34.405557","-83.212157","false","0","s","L1AAA","ADDRESS","L","34.405557","-83.212157"

This is very similar to how people were using the YahooFinance API before Yahoo closed it. If you searched this forum for posts relating to the YahooFinanance API, you will be able to see some samples of code with parsing that were being used and adjust them to fit your needs on MapQuest.

This may sound a little vague but I am trying to point you in the right direction...

Poke around this site:

https://developer.mapquest.com/documentation/samples/geocoding/v1/reverse/

For a free KEY try here:

https://developer.mapquest.com/plans

I hope this helps...
 
Last edited:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,956
Messages
5,834,579
Members
430,298
Latest member
Stanles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top