ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I make a number have leading zeros to fill width of cell? (https://www.excelbanter.com/excel-discussion-misc-queries/50469-how-do-i-make-number-have-leading-zeros-fill-width-cell.html)

Max_Rebo1

How do I make a number have leading zeros to fill width of cell?
 
I am trying to format existing data so that instead of being a set amount of
digits, say 2 for example, it fills out the column based on its width, say 6,
with leading zeros. Example - I have 55122 in a cell that has a width of 6,
and I want it to say 055122. I know that changing the cell format to text and
re-entering the data would fix this problem, but I want a way to change the
data without re-entering it.

Bob Phillips

You can use a custom format of 000000, but by width, do you mean that if the
cell is widened it gets extra leading digits?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Max_Rebo1" wrote in message
...
I am trying to format existing data so that instead of being a set amount

of
digits, say 2 for example, it fills out the column based on its width, say

6,
with leading zeros. Example - I have 55122 in a cell that has a width of

6,
and I want it to say 055122. I know that changing the cell format to text

and
re-entering the data would fix this problem, but I want a way to change

the
data without re-entering it.




Dave Peterson

If you know that you want 6 digits, you can use a custom format of:
000000
select the column
format|cells|number tab|custom category

You could try this custom format, too:
0*0

If you widen the cell, you may see what looks like a gap between the leading 0
and the number you typed into the cell. But if you widen/shrink that column,
you'll see that this gap disappears.




Max_Rebo1 wrote:

I am trying to format existing data so that instead of being a set amount of
digits, say 2 for example, it fills out the column based on its width, say 6,
with leading zeros. Example - I have 55122 in a cell that has a width of 6,
and I want it to say 055122. I know that changing the cell format to text and
re-entering the data would fix this problem, but I want a way to change the
data without re-entering it.


--

Dave Peterson

B. R.Ramachandran

Hi,

Select the data region -- "Format" -- "Cells" -- Select "Custom" under
"Category" -- Enter 000000 under "Type" -- "OK"
(In fact you can see under "Sample", a preview of how the numbers will be
formatted, as you are enter the 0's under "Type")

Regards,
B. R. Ramachandran

"Max_Rebo1" wrote:

I am trying to format existing data so that instead of being a set amount of
digits, say 2 for example, it fills out the column based on its width, say 6,
with leading zeros. Example - I have 55122 in a cell that has a width of 6,
and I want it to say 055122. I know that changing the cell format to text and
re-entering the data would fix this problem, but I want a way to change the
data without re-entering it.


Max_Rebo1

Thank you all, that worked great!!

"Max_Rebo1" wrote:

I am trying to format existing data so that instead of being a set amount of
digits, say 2 for example, it fills out the column based on its width, say 6,
with leading zeros. Example - I have 55122 in a cell that has a width of 6,
and I want it to say 055122. I know that changing the cell format to text and
re-entering the data would fix this problem, but I want a way to change the
data without re-entering it.



All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com