C
cadfael
Greetings all,
I want to sort lists of IP addresses, which Excel normally treats as
strings.
IP addresses are 32-bit binary numbers usually represented as
8-character hexidecimal strings, from 00000000 to FFFFFFFF. For
brevity and to make them easier to grasp they are usually written in
"dotted quad" notation, where the binary or hexidecimal string is split
into four "quads" separated by decimal points. So, the IP address for
www.excelforum.com is '66.98.166.8' but in reality this number is
understood by your computer to be '4262A608' in hex, or 1113761288 in
decimal (if you want to experiment, try entering 'http://1113761288'
into your browser and you'll see that you can still pull up the site).
Excel tries to sort dotted-quad addresses as strings and therefore does
not sort them properly--it will place the IP address 1.1.2.1 AFTER
1.2.21.1 if you try to sort them in ascending order.
Typically when I have to sort large tables of IP addresses, I just
include a row for the "straight decimal" form of the address. I'd like
to do away with this if possible and have Excel read the
straight-decimal format but display the dotted-quad format. Does
anyone know how I can accomplish this?
Thanks in advance,
Pete
I want to sort lists of IP addresses, which Excel normally treats as
strings.
IP addresses are 32-bit binary numbers usually represented as
8-character hexidecimal strings, from 00000000 to FFFFFFFF. For
brevity and to make them easier to grasp they are usually written in
"dotted quad" notation, where the binary or hexidecimal string is split
into four "quads" separated by decimal points. So, the IP address for
www.excelforum.com is '66.98.166.8' but in reality this number is
understood by your computer to be '4262A608' in hex, or 1113761288 in
decimal (if you want to experiment, try entering 'http://1113761288'
into your browser and you'll see that you can still pull up the site).
Excel tries to sort dotted-quad addresses as strings and therefore does
not sort them properly--it will place the IP address 1.1.2.1 AFTER
1.2.21.1 if you try to sort them in ascending order.
Typically when I have to sort large tables of IP addresses, I just
include a row for the "straight decimal" form of the address. I'd like
to do away with this if possible and have Excel read the
straight-decimal format but display the dotted-quad format. Does
anyone know how I can accomplish this?
Thanks in advance,
Pete