Sort IP address.

  • Thread starter Thread starter Guest
  • Start date Start date
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".
 
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
 
Back
Top