dec 2 bin conversion

S

sai

I need to calculate the binary conversion of numbers > 511. Is there any
option for it as I am getting a #NUM error whenever i try to calculate that.
 
M

Mike H

Hi,

Dec2bin runs out of steam at >511 try this for larger No's

=DEC2BIN((MOD(A1,4294967296)/16777216),8) &
DEC2BIN(MOD(A1,16777216)/65536,8) & DEC2BIN(MOD(A1,65536)/256,8) &
DEC2BIN(MOD(A1,256),8)

Mike
 
P

Pete_UK

Excel Help tells you that the range of numbers that can be used is
limited to -512 up to +511, as a maximum of 10 places is available for
output (2^10 = 1024).

If you need to show more places then you could split the number by
repeated division by, say, 256, and combine the output strings
together, or you could use a UDF to do the conversion.

Hope this helps.

Pete
 

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