ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Decimal to Hexadecimal (https://www.excelbanter.com/excel-discussion-misc-queries/124916-decimal-hexadecimal.html)

Sean Timmons

Decimal to Hexadecimal
 
So, my company tracks items based on DEC and HEX, some with one, some with
the other. I'm tryign to create a formula that will convert items that have,
say DEC to HEX and vice versa. Problem is, when I attempt DECTOHEC and
HEXTODEC, it doesn't match what I get using my company's lookup tool (an
arduous process)

Here's what the company conversion are for a sample set of numbers:
DEC HEX
02313552326 17cecac6
02313552451 17cecb43
02313552469 17cecb55
02313552512 17cecb80
02313552538 17cecb9a
02313552779 17cecc8b
02313552798 17cecc9e
02313552829 17ceccbd
02313552891 17ceccfb
02313552900 17cecd04
05112837432 33C3E238

And Dec2Hex() gives me:
DEC HEX
02313552326 89E601C6
02313552451 89E60243
02313552469 89E60255
02313552512 89E60280
02313552538 89E6029A
02313552779 89E6038B
02313552798 89E6039E
02313552829 89E603BD
02313552891 89E603FB
02313552900 89E60404
05112837432 130BFB538

I'm missing something... :-/

Mike

Decimal to Hexadecimal
 
Sean,

Your Co conversions look dodgy to me and the results Excel comes up with
can be verified here http://www.statman.info/conversions/hexadecimal.html.

Confused

"Sean Timmons" wrote:

So, my company tracks items based on DEC and HEX, some with one, some with
the other. I'm tryign to create a formula that will convert items that have,
say DEC to HEX and vice versa. Problem is, when I attempt DECTOHEC and
HEXTODEC, it doesn't match what I get using my company's lookup tool (an
arduous process)

Here's what the company conversion are for a sample set of numbers:
DEC HEX
02313552326 17cecac6
02313552451 17cecb43
02313552469 17cecb55
02313552512 17cecb80
02313552538 17cecb9a
02313552779 17cecc8b
02313552798 17cecc9e
02313552829 17ceccbd
02313552891 17ceccfb
02313552900 17cecd04
05112837432 33C3E238

And Dec2Hex() gives me:
DEC HEX
02313552326 89E601C6
02313552451 89E60243
02313552469 89E60255
02313552512 89E60280
02313552538 89E6029A
02313552779 89E6038B
02313552798 89E6039E
02313552829 89E603BD
02313552891 89E603FB
02313552900 89E60404
05112837432 130BFB538

I'm missing something... :-/


James Silverton

Decimal to Hexadecimal
 
Hello, Mike!
You wrote on Fri, 5 Jan 2007 12:40:02 -0800:

M Your Co conversions look dodgy to me and the results Excel
M comes up with can be verified here
http://www.statman.info/conversions/hexadecimal.html.

M Confused

M "Sean Timmons" wrote:

?? So, my company tracks items based on DEC and HEX, some
?? with one, some with the other. I'm tryign to create a
?? formula that will convert items that have, say DEC to HEX
?? and vice versa. Problem is, when I attempt DECTOHEC and
?? HEXTODEC, it doesn't match what I get using my company's
?? lookup tool (an arduous process)
??
?? Here's what the company conversion are for a sample set of
?? numbers: DEC HEX 02313552326 17cecac6
02313552451
?? 17cecb43 02313552469 17cecb55 02313552512 17cecb80
?? 02313552538 17cecb9a 02313552779 17cecc8b 02313552798
?? 17cecc9e 02313552829 17ceccbd 02313552891 17ceccfb
?? 02313552900 17cecd04 05112837432 33C3E238
??
?? And Dec2Hex() gives me:
?? DEC HEX
?? 02313552326 89E601C6
??
?? I'm missing something... :-/

The Excel values seem correct to me, two different calculators
and the Windows calculator!

James Silverton
Potomac, Maryland

E-mail, with obvious alterations:
not.jim.silverton.at.comcast.not


[email protected]

Decimal to Hexadecimal
 
Sean Timmons wrote:
So, my company tracks items based on DEC and HEX, some with one, some with
the other. I'm tryign to create a formula that will convert items that have,
say DEC to HEX and vice versa. Problem is, when I attempt DECTOHEC and
HEXTODEC, it doesn't match what I get using my company's lookup tool (an
arduous process)
[....]
I'm missing something... :-/


Yes: the fact that your company uses a special algorithm to effect the
conversion, not a straigtht-forward conversion from decimal to hex,
like Excel does.

Here's what the company conversion are for a sample set of numbers:
DEC HEX
02313552326 17cecac6
[....]
05112837432 33C3E238


I might not be able to tell you the precise algorithm. But based on
the few examples given, the following Excel formulation yields the same
results:

=DEC2HEX(LEFT(A1,LEN(A1)-8)) & DEC2HEX(RIGHT(A1,8))

where A1 is the decimal number. In other words, the right-most 8
digits are taken as a number and converted to hex, which is appended to
the remaining left-most digits taken as a number and converted to hex.


Dana DeLouis

Decimal to Hexadecimal
 
DEC HEX
02313552326 17cecac6


Hi. Your company breaks the Dec number into 2 parts.
23 & 13552326

23 is 17 hex
13552326 is cecac6 hex

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"Sean Timmons" wrote in message
...
So, my company tracks items based on DEC and HEX, some with one, some with
the other. I'm tryign to create a formula that will convert items that
have,
say DEC to HEX and vice versa. Problem is, when I attempt DECTOHEC and
HEXTODEC, it doesn't match what I get using my company's lookup tool (an
arduous process)

Here's what the company conversion are for a sample set of numbers:
DEC HEX
02313552326 17cecac6
02313552451 17cecb43
02313552469 17cecb55
02313552512 17cecb80
02313552538 17cecb9a
02313552779 17cecc8b
02313552798 17cecc9e
02313552829 17ceccbd
02313552891 17ceccfb
02313552900 17cecd04
05112837432 33C3E238

And Dec2Hex() gives me:
DEC HEX
02313552326 89E601C6
02313552451 89E60243
02313552469 89E60255
02313552512 89E60280
02313552538 89E6029A
02313552779 89E6038B
02313552798 89E6039E
02313552829 89E603BD
02313552891 89E603FB
02313552900 89E60404
05112837432 130BFB538

I'm missing something... :-/




Sean Timmons

Decimal to Hexadecimal
 
Now, that was some good calculating! thank you su much for figuring that out!
It was driving me silly!

"Dana DeLouis" wrote:

DEC HEX
02313552326 17cecac6


Hi. Your company breaks the Dec number into 2 parts.
23 & 13552326

23 is 17 hex
13552326 is cecac6 hex

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"Sean Timmons" wrote in message
...
So, my company tracks items based on DEC and HEX, some with one, some with
the other. I'm tryign to create a formula that will convert items that
have,
say DEC to HEX and vice versa. Problem is, when I attempt DECTOHEC and
HEXTODEC, it doesn't match what I get using my company's lookup tool (an
arduous process)

Here's what the company conversion are for a sample set of numbers:
DEC HEX
02313552326 17cecac6
02313552451 17cecb43
02313552469 17cecb55
02313552512 17cecb80
02313552538 17cecb9a
02313552779 17cecc8b
02313552798 17cecc9e
02313552829 17ceccbd
02313552891 17ceccfb
02313552900 17cecd04
05112837432 33C3E238

And Dec2Hex() gives me:
DEC HEX
02313552326 89E601C6
02313552451 89E60243
02313552469 89E60255
02313552512 89E60280
02313552538 89E6029A
02313552779 89E6038B
02313552798 89E6039E
02313552829 89E603BD
02313552891 89E603FB
02313552900 89E60404
05112837432 130BFB538

I'm missing something... :-/





[email protected]

Decimal to Hexadecimal
 
PS....

I wrote:
Sean Timmons wrote:
Here's what the company conversion are for a sample set of numbers:
DEC HEX
02313552326 17cecac6
[....]
05112837432 33C3E238

[....]
=DEC2HEX(LEFT(A1,LEN(A1)-8)) & DEC2HEX(RIGHT(A1,8))


That works fine when the right-most 8 digits form the number 001048576
or higher. That always yields 6 hex digits. It is unclear what your
company's algorithm would do with "numbers" less than 001048576. If
they zero-fill to 6 hex digits, as I suspect, use:

=DEC2HEX(LEFT(A1,LEN(A1)-8)) & DEC2HEX(RIGHT(A1,8),6)

Also note that the formula assumes the entire decimal number (A1) is at
least 9 digits.



All times are GMT +1. The time now is 04:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com