IP to Country in Excel

I have a spreadsheet that has a column with IP addresses. I now need to populate another column with the country that IP is registered to.

 

Ideally I would simply put some code like a short HTML line or a hyperlink in an adjacent column like: http://api.hostip.info/flag.php?ip=xxx.xxx.xxx.xxx, where xxx.xxx.xxx.xxx would be the cell that contains the IP. I have 2 problems with this approach right now though. The first is that I would like Excel to show me the "output of that hyperlink right there in the cell rather than trying to open a browser window. The second problem is inserting the cell reference into the hyperlink, like G3, without the hyperlink literallt becoming  http://api.hostip.info/flag.php?ip=G3.

 

The other way I was looking at accomplishing this was to compare the IPs in the G column against another spreadsheet I got with all known IP number ranges and their respective countries. The problem with that is after I convert that IP address into a unique IP number, I don't know how to compare that against the entire columns of the other spreadsheet. How do I test whether the IP number whose owning country I am looking for falls between a number falls between a number in column A and column B of the same row in the other speadsheet.

 

Any help would be greatly appreciated.

August 30th, 2010 1:41pm

Hello,

Assuming A2 = 255.255.255.255, this formula will give you http://api.hostip.info/flag.php?ip=xxx.xxx.xxx.xxx

="http://api.hostip.info/flag.php?ip=" & A2

Your second inquiry should be resolved via you other post http://social.technet.microsoft.com/Forums/en-US/excel/thread/b08c5069-3fbd-4bbe-82cd-4c50ca651b7b.


Best Regards,
Chad

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2010 7:55pm

The free vba code in this page can fetch city or country code from IP address.

http://officetricks.com/find-ip-address-location-geoip-lookup/

The Code can be customized to fetch geo location detail even for a list of IP addresses.

April 26th, 2015 10:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics