Home |
Search |
Today's Posts |
#3
![]() |
|||
|
|||
![]()
Andibevan wrote...
As far as I understand the standard Bin2Dec and Dec2Bin functions can only handle 10 character binary numbers. Does anyone have any pointers on how to handle binary numbers greater than this? If I have completely mis-understood how excel handles binary numbers feel free to let me know. You've been given a udf, which is flexible enough to handle many radices. A quicker alternative would be downloading and installing Laurent Longre's MOREFUNC.XLL add-in, available from http://longre.free.fr/english which includes a function named CHBASE that does the same thing. If all you need to work with are binary numbers, you could forgo both udfs and add-ins and use divide-and-conquer. A1: (decimal number) 7654321 A2: (binary string with leading zeros) =DEC2BIN(INT(A1/2^24),8)&DEC2BIN(INT(MOD(A1,2^24)/2^16),8) &DEC2BIN(INT(MOD(A1,2^16)/2^8),8)&DEC2BIN(MOD(A1,2^8),8) A3: (binary string without leading zeros) =MID(DEC2BIN(INT(A1/2^24),8)&DEC2BIN(INT(MOD(A1,2^24)/2^16),8) &DEC2BIN(INT(MOD(A1,2^16)/2^8),8)&DEC2BIN(MOD(A1,2^8),8), INT(33-LOG(A1,2)),32) A4: (decimal number derived from A2 - would be the same for A3) =SUMPRODUCT(--MID(RIGHT(REPT("0",32)&A2,32),ROW(INDIRECT("1:32") ),1), 2^(32-ROW(INDIRECT("1:32")))) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Match Last Occurrence of two numbers and Return Date | Excel Worksheet Functions | |||
Match Last Occurrence of two numbers and Count to Previous Occurence | Excel Worksheet Functions | |||
Count and Sum Total occurrances of two specific numbers | Excel Worksheet Functions | |||
Converting Numbers to Text properly | Excel Discussion (Misc queries) | |||
Converting characters to numbers | Excel Worksheet Functions |