"Kaleem Habib" ha scritto nel messaggio
...
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/micros...30a740447345c8
ivano