Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
BobD
 
Posts: n/a
Default Sorting using HEX

How do you sort a column of data that is in hexidecimal? I sort by column and
it scrambles because it is in hex.
Thak you.
  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
one idea (not tested though) use in a helper column the formula
=HEX2DEC(A1)
copy this for all rows and sort with this column

Note: You need to install the Analysis Toolpak Addin for this

--
Regards
Frank Kabel
Frankfurt, Germany

"BobD" schrieb im Newsbeitrag
...
How do you sort a column of data that is in hexidecimal? I sort by

column and
it scrambles because it is in hex.
Thak you.


  #3   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Wed, 10 Nov 2004 09:18:01 -0800, "BobD"
wrote:

How do you sort a column of data that is in hexidecimal? I sort by column and
it scrambles because it is in hex.
Thak you.


Convert the data to decimal in a helper column, then sort on that column. You
can use the HEX2DEC worksheet function. If you get the #NAME error, look at
HELP for that function.

If your HEX numbers are greater than 7FFFFFFFFF post back and I will post a VBA
routine that can convert larger HEX numbers.


--ron
  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

"Ron Rosenfeld" wrote...
....
If your HEX numbers are greater than 7FFFFFFFFF post back and I will
post a VBA routine that can convert larger HEX numbers.


Why bother with VBA? 15 decimal digits of precision means the largest
hexadecimal number that could be accomodated without having to resort to
string-based arbitrary precision is 38D7EA4C68000 (=10^15 decimal). Assuming
smaller hexadecimal numbers should always be treated as unsigned, built-in
functions suffice.

=IF(LEN(x)<9,HEX2DEC("0"&x),
HEX2DEC("0"&LEFT(x,LEN(x)-9))*16^9+HEX2DEC("0"&RIGHT(x,9)))


  #5   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Thu, 11 Nov 2004 01:01:19 -0800, "Harlan Grove" wrote:

"Ron Rosenfeld" wrote...
...
If your HEX numbers are greater than 7FFFFFFFFF post back and I will
post a VBA routine that can convert larger HEX numbers.


Why bother with VBA? 15 decimal digits of precision means the largest
hexadecimal number that could be accomodated without having to resort to
string-based arbitrary precision is 38D7EA4C68000 (=10^15 decimal). Assuming
smaller hexadecimal numbers should always be treated as unsigned, built-in
functions suffice.

=IF(LEN(x)<9,HEX2DEC("0"&x),
HEX2DEC("0"&LEFT(x,LEN(x)-9))*16^9+HEX2DEC("0"&RIGHT(x,9)))


Given your stated limits, there would be no need to use VBA.



--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Sorting Spreadsheet with Merged Fields Linda L Excel Discussion (Misc queries) 1 January 22nd 05 12:58 AM
Sorting problem Klaus Excel Discussion (Misc queries) 3 December 4th 04 01:55 AM
sorting question Brian Excel Discussion (Misc queries) 4 November 28th 04 12:30 PM
Macro for sorting different rows ciscopena Excel Worksheet Functions 0 November 1st 04 11:04 PM


All times are GMT +1. The time now is 05:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"