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

dee101

Active Member
Joined
Aug 21, 2004
Messages
282
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 Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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:
Upvote 0
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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
Back
Top