ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conversion of Dec numbers to Bin, Oct and Hex and visa versa (https://www.excelbanter.com/excel-worksheet-functions/32620-conversion-dec-numbers-bin-oct-hex-visa-versa.html)

Kaleem Habib

Conversion of Dec numbers to Bin, Oct and Hex and visa versa
 
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



Bob Phillips

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

--
HTH

Bob Phillips

"Kaleem Habib" wrote in message
...
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





ivano


"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




All times are GMT +1. The time now is 01:28 AM.

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