Solved

IP to Country in Excel file

Posted on 2011-03-15
13
2,398 Views
Last Modified: 2012-06-27
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.


Thanks for your help
0
Comment
Question by:cawasaki
  • 6
  • 3
  • 2
  • +2
13 Comments
 
LVL 10

Expert Comment

by:Fayaz
Comment Utility

May I ask you to rephrase your question please?
0
 

Author Comment

by:cawasaki
Comment Utility
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

by:nutsch
Comment Utility
You can download an ip database like the one at http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip?XID=b56e23bc37fc4f96df30fad5458b433c

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

by:nutsch
Comment Utility
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

by:cawasaki
Comment Utility
Thanks thomas

can you upload plz an example with excel file?

thanks
0
 

Author Comment

by:cawasaki
Comment Utility
i have Excel 2007
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 39

Expert Comment

by:nutsch
Comment Utility
Here is an example, including that database. You can have IPs with . or not.

Thomas
ip-to-country.xlsx
0
 
LVL 24

Expert Comment

by:jimyX
Comment Utility
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

by:cawasaki
Comment Utility
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

by:cawasaki
Comment Utility
Any help?
0
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
Comment Utility
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

by:cawasaki
Comment Utility
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

by:redmondb
Comment Utility
cawasaki,

Many thanks for that!

Regards,
Brian.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Earnings Spreadsheet in Excel 3 38
Help with Journey Roadmap Graphic 11 47
Problem to open Excel file 15 37
Macro 3 13
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now