adding a trailing zero

  • Thread starter Thread starter Sammy
  • Start date Start date
S

Sammy

I have a column that contains 4 digit numbers
0001
0011
1111
etc.
what I need is a function that will add a zero to this
number if the first digit is a zero and leave the rest
alone
exp. if the first number in A1 is = to "0" (0001) the add
a zero so the number is now (00001), if the first number
is not a zero (1111) do nothing

thank you for any help!
 
Your message subject says trailing zeroes. Your example shows a leading zero.
I'm not sure which you want.

Are your entries numbers or text? Did you achieve the leading zeroes by
formatting? If so, they are numbers, and you can just change the format:

[<1000]00000;0000

If you meant trailing zeroes, and you don't want to multiply the numbers by
10, use this format

[<1000],0000"0";0000
 
exp. if the first number in A1 is = to "0" (0001) the add
a zero so the number is now (00001), if the first number
is not a zero (1111) do nothing

These values are text format already?

=IF(LEFT(A1,1)="0",0&A1,A1)

Rgds,
Andy
 
Back
Top