Inserting a specific number of blank spaces

itldp

New Member
Joined
Mar 31, 2003
Messages
21
Hi all!

is there any way i can write one formula to insert a specific spaces after text in a cell?

probably makes no sense, so here is my example:

HAIR
FASHION

i need to make sure that the text occupies 15 spaces so that when it is exported into a text file, the columns are lined up correclty. therefore, i need to add 11 spaces after the word hair and 8 spaces after the word fashion.

I know to use the length function, but then what? please let me know if you need more info.

Thanks! :wink:
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
itldp said:
Hi all!

is there any way i can write one formula to insert a specific spaces after text in a cell?

probably makes no sense, so here is my example:

HAIR
FASHION

i need to make sure that the text occupies 15 spaces so that when it is exported into a text file, the columns are lined up correclty. therefore, i need to add 11 spaces after the word hair and 8 spaces after the word fashion.

I know to use the length function, but then what? please let me know if you need more info.

Thanks! :wink:

YourNewString = "HAIR"
Using The LEN function to determin how much less the text is from 15

YourPad = SPACE(15 - LEN("HAIR"))
YourNewString = YourNewString & YourPad
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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