Text Formatting

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I need some help ...

I have a column of text that must always maintain a set # of characters (40) regardless of how short the text value is.
Is there a way to force spaces to be added ... ie formatting a cell that ensures there are always 40 characyers? Something like entering a number 23.45 into a cell formated as 000.0000 gives you 023.4500?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi there RobK, welcome to the Board,

Paste this formula in B1 and scroll down:

=A1&REPT(" ",40-LEN(A1))

This will add spaces to anything in column A so that the total number of characters equals 40

Hope this gives you some ideas

regards
Derek
 
Upvote 0
Hi Robk:

Just to add to Derek's contribution, you may add the space character (or for that matter any other character), before or after the actual word to make it of any specific length (in our case here that is 40).
 
Upvote 0
This is fantastic!!! Thanks for your help everyone.
Yogi .... how would I place spaces in front of the text, rather than after?
 
Upvote 0
Not to steal anyone's thunder but swap the formula around.

=REPT(...)&A1

The & is a shortcut for concatenate. It joins two text strings together.
 
Upvote 0

Forum statistics

Threads
1,214,527
Messages
6,120,057
Members
448,940
Latest member
mdusw

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