How do I add leading spaces to a value?

G

Guest

I have a list of values that vary in length, but I need to convert all of
them to 10 characters with spaces, not 0's as prefixes.

I have been able to use the text command to add 0's, but unable to add spaces.

Thanks in advance for any help!

-Chris
 
G

Guest

Try something like this:

For a value in A1
B1: =RIGHT(TEXT(A1," 0"),10)

Note: That format includes 10 spaces before the 0.

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro
 
G

Guest

Hi

Try something like this:
=REPT(" ",10-LEN(A2))&A2

Once done, you'll have to Copy the range and then Edit/Paste Special/Values
to fix the values.

Hope this helps.
Andy.
 

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