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

dee101

Active Member
Joined
Aug 21, 2004
Messages
261
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
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,493
Office Version
365, 2010
Platform
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:

Watch MrExcel Video

Forum statistics

Threads
1,099,122
Messages
5,466,825
Members
406,501
Latest member
TheoDoc

This Week's Hot Topics

Top