Padding a Number

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have a text column of numbers that range from 6 to 9
characters in length. I need to left pad with zeros so
that all of the numbers are 9 characters in length. Can
you tell me the function I should use and possibly provide
an example?

TIA
Chris
 
Chris said:
I have a text column of numbers that range from 6 to 9
characters in length. I need to left pad with zeros so
that all of the numbers are 9 characters in length. Can
you tell me the function I should use and possibly provide
an example?

TIA
Chris

One way:
=RIGHT("000"&A1,9)
 
-----Original Message-----
try format>custom format>000000000 (that's 9 0's)

--
Don Guillett
SalesAid Software
Granite Shoals, TX
(e-mail address removed)



.
 
Quite right. OP said he had a text column. You suggested he try a custom
format. Applying a custom format to a text column will do nothing. It has to
be converted from text first, which you didn't mention.
 
Sub FixRangeValues()
For Each c In Selection
c.Value = Format(c, "00")
Next
End Sub
 
Back
Top