PDA

View Full Version : Sleeper: The opposite of TRIM



ukdane
06-03-2009, 01:27 AM
Is there an opposite of TRIM,
I have a series of variables, all of which need to be at least X characters long. Each varaible has its own length Y.
If the varaible Y is shorter that X, I need to add X-Y blank spaces to the variable.

This needs to be done so that the formating of some numbers are the same.

Is there an easy solution that DOESN'T require a loop?
(I want to avoid loops as there are rather a large number of variables, contained within an array that will need to be processed)

MaximS
06-03-2009, 01:37 AM
try that function


=if(len(A1)<x, A1&Rept(" ", x - len(A1)), A1)

mikerickson
06-03-2009, 06:07 AM
Or perhaps
=LEFT(A1&REPT(" ",X), X)