Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
scallyte
 
Posts: n/a
Default How to get leading zeros using DEC2BIN

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

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student
 
Posts: n/a
Default How to get leading zeros using DEC2BIN

Use either =--dec2bin(1)
or
=dec2bin(1)*1
Then the formating will hold.
--
Gary''s Student


"scallyte" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JE McGimpsey
 
Posts: n/a
Default How to get leading zeros using DEC2BIN

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).





In article .com,
"scallyte" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spliting a number with leading zeros haitch2 Excel Discussion (Misc queries) 7 September 30th 05 12:09 AM
CSV File - Leading Zeros Floridagal Excel Discussion (Misc queries) 2 August 6th 05 12:34 AM
How do I force leading zeros in an Excel cell? EricKei Excel Discussion (Misc queries) 2 June 15th 05 08:28 PM
Leading zeros Paul Excel Discussion (Misc queries) 4 June 12th 05 04:04 AM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 06:21 PM


All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"