Adding spaces to a text string?

MichaelRSnow

Active Member
Joined
Aug 3, 2010
Messages
409
I have many rows of data over 2 columns (A & B), which I need to format in column 3 (C) i.e. add 6 characters, space then 7 characters</SPAN>

Some of the data in the columns may only be 2 characters long so I need to pad it out to 6 with 4 spaces, is there are formula which exists that can check the length and add spaces to the end of the text string to hit the max length required?

Example


A</SPAN>
B</SPAN>
C</SPAN>
LEN = 6</SPAN>
LEN = 7</SPAN>
LEN = 6 + SPACE + 7</SPAN>
123456</SPAN>
1234567</SPAN>
123456 1234567 (LEN = 14)</SPAN>
22</SPAN>
12345</SPAN>
22 12345 (LEN = 14)</SPAN>

<TBODY>
</TBODY>
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
sorry not getting what actually you need

can you post some more data with desired result ?
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,573
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top