Sorting by IP Subnets

J

JohnV

I've looked everywhere but I can't find any information on how, if possible,
to sort by subnets.
ie. If I sort the following data in Excel, I have the following data:
192.168.1.0
192.168.10.0
192.168.8.0

But I want the following to occur,
192.168.1.0
192.168.8.0
192.168.10.0

as the 3rd octet, 8, is less than 10.

Any ideas???
 
M

Mike A

The problem is that the addresses are not numbers. They sort
alphabetically.

You could enter the octets in separate cells, say a1 to d1, and sort
on the right-hand two columns. Then, where you want the dotted-four
format to appear, use the formula:

=CONCATENATE(A1,".",B1,".",C1,".",D1)

Then auto-fill or copy the formula down however many rows you need.

You can hide the columns with the separate octets, if you wish.


-Mike




I've looked everywhere but I can't find any information on how, if possible,
to sort by subnets.
ie. If I sort the following data in Excel, I have the following data:
192.168.1.0
192.168.10.0
192.168.8.0

But I want the following to occur,
192.168.1.0
192.168.8.0
192.168.10.0

as the 3rd octet, 8, is less than 10.

Any ideas???

Mike Argy
Custom Office Solutions
and Windows/UNIX applications

Please post on-topic responses to the newsgroup

To e-mail me, remove nospam from the address in the headers
 
D

Dave Peterson

N

Nikos Yannacopoulos

John,

Copy the IP column to an empty one and parse (Data > Text to Columns) using
period as a delimiter. Then you can sort on the subnet (now a numeric column
on its own right), while your original column still holds the whole IP.

HTH,
Nikos
 
J

JohnV

Thanks to everybody for their response especially Dave. That Dave McRitchie
link was the best solution for me.
 

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

Similar Threads


Top