Conversion of Dec numbers to Bin, Oct and Hex and visa versa

K

Kaleem Habib

I'm attempting to produce an excel spreadsheet that can convert decimal
numbers (up to any value) to binary, octal and hexadecimal. Conversely I'm
also trying to produce an excel spreadsheet that can convert Hex values to
binary, octal and decimal. I need to create this spreadsheet without the use
of the dec2hex, dec2bin etc excel functions. Basically the spreadsheet needs
to be able to replicate the results of these excel functions without
actually using them. The solution has to be contained within the
spreadsheets. I can't use the VB module within Excel to derive the solution.

Thanks for your help

Regards....Kaleem
 
B

Bob Phillips

Withoiut the ATP, without VBA. I think you are going to be struggling to
handle any value.
 
I

ivano

Kaleem Habib said:
I'm attempting to produce an excel spreadsheet that can convert decimal
numbers (up to any value) to binary, octal and hexadecimal. Conversely I'm
also trying to produce an excel spreadsheet that can convert Hex values to
binary, octal and decimal. I need to create this spreadsheet without the use
of the dec2hex, dec2bin etc excel functions. Basically the spreadsheet needs
to be able to replicate the results of these excel functions without
actually using them. The solution has to be contained within the
spreadsheets. I can't use the VB module within Excel to derive the solution.

Thanks for your help

Regards....Kaleem

Hy Kaleem,
for decimal to binary you can use:
=SUM(((0&REPT("8",ROW(INDIRECT("1:"&INT(LOG(A1,2)+1)))-1))+1)*ROUND($H$1/(2^
ROW(INDIRECT("1:"&INT(LOG(A1,2)+1)))),0))

for decimal to other, i don't know now.

for binary to decimal:
=SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)*2^(LEN(A1)-ROW(INDIRECT("1:"&LEN(
A1)))))

for octal to decimal:
=SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)*8^(LEN(A1)-ROW(INDIRECT("1:"&LEN(
A1)))))

for hexadecimal to decimal:
=SUM((SEARCH(MID(A3,ROW(INDIRECT("1:"&LEN(A3))),1),"0123456789ABCDEF")-1)*16
^(LEN(A3)-ROW(INDIRECT("1:"&LEN(A3)))))

all are array formula, ctr+shift+enter

see also:
http://groups.google.it/group/micro...public.it.office.excel&hl=it#bb30a740447345c8

ivano
 

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

Top