Adding 2 0's to an existing number in a cell

  • Thread starter Thread starter Adam Drake
  • Start date Start date
A

Adam Drake

I'm trying to add two zeros to numbers in a column without
having to retype each number. It's not a cell reference,
but an absolute value in the cell. Is there a function
that will allow me to place two zeros in front of each
number without having me to retype them? Thanks.
 
A couple of ideas...

1. If what you really want to do is pad out the number with leading zeroes,
so that the value "1" becomes "001," 7 becomes "007," and 14 becomes "014,"
this is very easy. Format the range (group of cells, or maybe the whole
column) by going to Format > Cells > Number > Custom, and define a custom
format that is 000. That is, in the little window in the dialog that has
the word "Type:" above it, enter the value 000.
Apply this to your range and you'll have a bunch of numbers padded with as
many leading zeroes as it takes to make them 3 digits.

2. If you literally meant to prefix two zeroes before the numbers,
regardless of how many digits they had, and the number they have varies, the
best way I know to do that is to apply the following formula in cell B1
(assuming the first value is in cell A1):

="00"&TEXT(A1,"##0")

....then copy the formula down in column B, beside each value in column A.

That formula takes the numeric value in A1, converts it to a text string
with no decimal or digits after the decimal. Now that it's a text string,
it adds the text string "00" (two zeroes) in front of it. The adding
operator is the ampersand, or "&". It's really called "concatenating" the
two strings, or groups of character, together into one string.

I think any approach that doesn't turn it into a string is probably going to
fail, as I don't know a format approach (like in option 1) that will place 2
zeroes regardless of the number of digits.


HTH,

--Pete
 
You could format the cells to display the 2 zeros. Select
all the cells and go to Format > Cells > Number tab and
choose "Custom". To the right put:

"00"General

and press OK.

HTH
Jason
Atlanta, GA
 
Allrighty, then! Very good, Jason. Much simpler and more elegant than my
clunky string approach.
--Pete
 
Back
Top