Why doesn't this work?

ScottInTexas

Board Regular
Joined
Oct 28, 2003
Messages
178
I thought it was simple, but I get a #Num! error.
=DEC2BIN(1024,10)
At first I used a reference =DEC2BIN(T6,10) but that gave the error, so I used a value for the number.

The syntax is exactly what is shown in the documentation. I am doing something wrong and can't see it.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Dec2bin does not handle numbers above 511, try using Base instead.
 
Upvote 0
Dec2bin does not handle numbers above 511, try using Base instead.
Thank you for your reply.

What about in VBA? Size restrictions there too? If I am in VBA and want to use a 10 bit value, to turn on the tenth bit I have to OR 512 with 0 to get 1000000000 (512). To turn that bit off I have to AND it with 511. Every bit except that one will retain it's value. But since I get an overflow error I am thinking, this too, is not allowed.
 
Upvote 0
Did you try using the BASE function?
 
Upvote 0
Never mind. I had a stupid moment. My variable needed to be long and I wasn't paying close enough attention.
 
Upvote 0
Solution
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top