+ Reply to Thread
Results 1 to 5 of 5

adding spaces to beginning text

  1. #1
    Registered User
    Join Date
    04-05-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    1

    Red face adding spaces to beginning text

    I want to add blank spaces to a cell with text

    My cells have up to 14 spaces
    If a cell as 1 or 2 characters -I want to add 6 spaces in front of text.
    If a cell as 3 or 4 characters-I want to add 5 spaces in front of text.
    If a cell as 5 or 6 characters-I want to add 4 spaces in front of text.
    If a cell as 7 or 8 characters-I want to add 3 spaces in front of text.
    If a cell as 9 or 10 characters-I want to add 2 spaces in front of text.
    If a cell as 11 or 12 characters-I want to add 1 spaces in front of text.

    Does anyone know how to do this?????

    Thanks BB

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: adding spaces to beginning text

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

    Assuming text is in A1. This will add spaces to the front of the text making it 14 in length total.


    Edit: see my next post for correct solution
    Last edited by Harribone; 04-07-2013 at 05:12 AM.
    Say thanks, click *

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: adding spaces to beginning text

    This should do.

    =REPT(" ",LOOKUP(LEN(A1),{1,3,5,7,9,11,13;6,5,4,3,2,1,0}))&A1

  4. #4
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: adding spaces to beginning text

    The attached will allow you to add a set amount of spaces infront of text.

    Sheet2 has a table with text length and number of spaces for that length to add.

    Sheet1 uses this to modify the text in Col A, result shown in Col B.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-24-2013
    Location
    Earth
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    81

    Re: adding spaces to beginning text

    Hi, Bilbo Baggins

    Try this Formula in your Calc Column , and look images result check

    Please Login or Register  to view this content.
    20130407 b0000181.jpg

    Good Luck !

+ 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