#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default hex2dec

I need to convert a list of 16 bit hex values to decimal. The list contains
both positive and negative numbers.

hex2dec works for a 10 digit but for anything less the number appears to be
padded with zeros and doesn't come out negative as it should. Example,
0xFFE6 comes out 65510 instead of -26(correct)

Is there a fix for this? The list is very long.

thanks,
tim
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,059
Default hex2dec

"twilkers" wrote:
hex2dec works for a 10 digit but for anything less the number appears to
be
padded with zeros and doesn't come out negative as it should. Example,
0xFFE6 comes out 65510 instead of -26(correct)


One way:

=HEX2DEC(A1) - 65536*AND(LEN(A1)=4,HEX2DEC(LEFT(A1,1))=8)


----- original message -----

"twilkers" wrote in message
...
I need to convert a list of 16 bit hex values to decimal. The list
contains
both positive and negative numbers.

hex2dec works for a 10 digit but for anything less the number appears to
be
padded with zeros and doesn't come out negative as it should. Example,
0xFFE6 comes out 65510 instead of -26(correct)

Is there a fix for this? The list is very long.

thanks,
tim


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,059
Default hex2dec

PS....

More straight-forward:

=HEX2DEC(A1) - 65536*(HEX2DEC(A1)32767)


----- original message -----

"JoeU2004" wrote in message
...
"twilkers" wrote:
hex2dec works for a 10 digit but for anything less the number appears to
be
padded with zeros and doesn't come out negative as it should. Example,
0xFFE6 comes out 65510 instead of -26(correct)


One way:

=HEX2DEC(A1) - 65536*AND(LEN(A1)=4,HEX2DEC(LEFT(A1,1))=8)


----- original message -----

"twilkers" wrote in message
...
I need to convert a list of 16 bit hex values to decimal. The list
contains
both positive and negative numbers.

hex2dec works for a 10 digit but for anything less the number appears to
be
padded with zeros and doesn't come out negative as it should. Example,
0xFFE6 comes out 65510 instead of -26(correct)

Is there a fix for this? The list is very long.

thanks,
tim



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
How do I 'Add-In' Hex2Dec formula? Hex2Dec....Help! Excel Worksheet Functions 2 October 19th 06 04:49 PM
Hex2Dec substitue? Stuart Peters Excel Discussion (Misc queries) 1 July 29th 06 07:44 AM
Can I use HEX2DEC with cell references vs. numbers? cjssas Excel Worksheet Functions 8 September 12th 05 07:45 PM
EXCEL HEX2DEC conversion error Jerry Excel Worksheet Functions 4 June 16th 05 03:48 AM


All times are GMT +1. The time now is 09:53 PM.

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"