How to get leading zeros using DEC2BIN

  • Thread starter Thread starter scallyte
  • Start date Start date
S

scallyte

I have a range formatted as 00000000. When I type 354 in a cell, I get
00000354 as expected. No problem.

When I use the Analysis Pak function = DEC2BIN(1), I get 1 instead of
the desired 00000001. A different function for example =SUM(1, 5)
works as expected and gives me 00000006.

How can I do this without VBA? Thanks
 
How about

=DEC2BIN(1,8)

From Help:
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 is 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

Back
Top