x
Solved

IP to Country in Excel file

Posted on 2011-03-15
Medium Priority
3,277 Views
Hi,

I have an Excel file with 1000 IP in the column, i need a way to automaticly get an IP country for each IP.

0
Question by:cawasaki
• 6
• 3
• 2
• +2

LVL 10

Expert Comment

ID: 35139716

0

Author Comment

ID: 35139796
I have a spreadsheet that has a column with IP addresses. I need to populate another column automaticly with the country that IP is registered to.
0

LVL 39

Expert Comment

ID: 35139875

Then do a vlookup on your ip using a formula like
=VLOOKUP(--SUBSTITUTE(A1,".",""),'ip-to-country.csv'!\$A\$1:\$E\$111799,5)

Thomas

0

LVL 39

Expert Comment

ID: 35139895
This will only work in excel 07 and above since excel 03 is limited at 65,536 rows, and the csv file has 111,799.

T
0

Author Comment

ID: 35139943
Thanks thomas

can you upload plz an example with excel file?

thanks
0

Author Comment

ID: 35139953
i have Excel 2007
0

LVL 39

Expert Comment

ID: 35139992
Here is an example, including that database. You can have IPs with . or not.

Thomas
ip-to-country.xlsx
0

LVL 24

Expert Comment

ID: 35140046
I have worked on such project before using programming language but did not finish it.
My finding was: there is range of numbers, every range represents a country, then you calculate any IP using an equation (math equation) to arrive to a particular number then you match the result number to the ranges to get the country.
0

Author Comment

ID: 35140061
Ok, this database is not correct.

i have found another solution:

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

It is possible to get a result in the excel file?  because this create a link and not show the result in the file.

thanks
0

Author Comment

ID: 35140664
Any help?
0

LVL 26

Accepted Solution

redmondb earned 2000 total points
ID: 35141455
cawasaki,

(1) nutsch's formula for converting dotted decimal addresses to pure decimal was incorrect. Please try the attached instead. (To save on the upload, I deleted all the rows in "ip-to-country" - just copy and paste the rows from the original beneath the header.)

(2) You mentioned that the database was incorrect. Was this because of the conversion error or did you find mistakes in the data? There are certainly gaps in it (e.g. 192.168.0.0 to 192.168.255.255 is one of the Private Address Spaces).

Thanks,
Brian.

ip-to-country-V2.xlsx
0

Author Comment

ID: 35141869
redmondb

thanks for your help,work very fine.

I mentionned that the database is incorect because i have test one frensh IP and ine the file it say Canada!
the error is in the formula not database!

now work perfect thanks
0

LVL 26

Expert Comment

ID: 35142925
cawasaki,

Many thanks for that!

Regards,
Brian.
0

Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.