Padding a Number

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
 
A

Anon

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

Chris Brown

-----Original Message-----
try format>custom format>000000000 (that's 9 0's)

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



.
 
A

Anon

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

Don Guillett

Sub FixRangeValues()
For Each c In Selection
c.Value = Format(c, "00")
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top