Consulting

Results 1 to 3 of 3

Thread: Sleeper: The opposite of TRIM

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Sleeper: The opposite of TRIM

    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)

  2. #2
    VBAX Mentor MaximS's Avatar
    Joined
    Sep 2008
    Location
    Stoke-On-Trent
    Posts
    360
    Location
    try that function

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

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Or perhaps
    =LEFT(A1&REPT(" ",X), X)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •