Show leading 0s for binary formatted cell?

D

David

How does one format a cell to display the leading zeros of
binary data (or of data of any format other than decimal,
for that matter)? In my case the binary data is created
with "dec2bin" function. The decimal equivalent of the
data is in the range of [0,15]. I want to display all 4
bits, including any leading zeros. For decimal data I can
display leading 0s by: format cells->number->category-
custom and creating custom format "0000" which causes 4
decimal characters to be displayed including any leading
zeros. When I apply the same format to binary data I'm not
getting it to work. I'm using Excel 97 SR-2. Am I doing
something wrong? Is there a way to do this?
Thanks in advance!
David
 
H

hgrove

David wrote...
How does one format a cell to display the leading zeros of
binary data (or of data of any format other than decimal, for
that matter)? In my case the binary data is created with
"dec2bin" function. The decimal equivalent of the data is in the
range of [0,15]. I want to display all 4 bits, including any leading
zeros. . . .

Merely as a time-wasting diversion, have you considered reading onlin
help for the DEC2BIN function? From which,

"Syntax

DEC2BIN(number,places)

[...]

Places is the number of characters to use. If places is omitted
DEC2BIN uses the minimum number of characters necessary. Places i
useful for padding the return value with leading 0s (zeros).
 

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