Sort IP address.

G

Guest

I need to sort IP addresses. I capture data from a program and put then in
Excel. I need to be able to insert leading zeros in the sections that have
less than 3-digits. IP address "123.123.123.3". If sorted "123.123.123.254"
comes before "123.123.123.3".
 
M

Mike Fogleman

Here is a trick that doesn't require the leading zeros. You will need 5
empty columns to the right of the IP column. If IPs are in column A copy
them to column B. Select the IP list in column B. From the menu select
Data/Text to Columns. Tell the Import Wizard "Delimited" and for the
separator Other type "." (decimal without the quotes). This will create 4
columns with 1 number each from the IP. Now select the entire block of data
(columns A:E) and from the menu select Data/Sort and choose column E -
Ascending. Now you can delete columns B:E, leaving column A sorted
correctly.

Mike F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top