+ Reply to Thread
Results 1 to 5 of 5

INSERT trailing spaces

Hybrid View

GMAGDNA INSERT trailing spaces 12-10-2008, 07:00 PM
shg You could use formatting for... 12-10-2008, 07:09 PM
daddylonglegs Perhaps =LEFT(A1&REPT("... 12-10-2008, 07:40 PM
shg As long as the number is 8 or... 12-10-2008, 07:41 PM
jimmy6060 Re: INSERT trailing spaces 12-09-2013, 10:47 AM
  1. #1
    Registered User
    Join Date
    09-12-2003
    Posts
    1

    INSERT trailing spaces

    Is there a Customer Number Type that will insert a specified number of trailing spaces (null characters)? Kinfd of like the Custome Number Type 00000 will insert leading zeroes for the balance of a 3 digit number.

    In other words, I will type in 12345 and have it format to:
    12345 <null><null><null>

    or type in 123456 and have it format to:
    123456<null><null>

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You could use formatting for a 1-. 2-, or 3-space pad based on the size of the number. To do it for the general case, you could use a formula:
          ---A---- ---B---- ---------------------------C----------------------------
      1        123 123      B1 and copied down =A1 & REPT(" ", MAX(0, 8 - LEN(A1)) )
      2       1234 1234                                                             
      3      12345 12345                                                            
      4     123456 123456                                                           
      5    1234567 1234567                                                          
      6   12345678 12345678
    You need to used a fixed-pitch font (Courier, Consolas) and right-justify column B.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721
    Perhaps

    =LEFT(A1&REPT(" ",8),8)

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    As long as the number is 8 or fewer digits ...

  5. #5
    Registered User
    Join Date
    12-09-2013
    Location
    Venice
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: INSERT trailing spaces

    hey, i just registered to say thank you to daddylonglegs!

    i needed to do the opposite of the Trim function, and this formula does exactly that (adding blank spaces at the end of a string, like a cobalt).

    thanks bro

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1