+ Reply to Thread
Results 1 to 8 of 8

need exactly 30 characters in a cell

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    12

    Question need exactly 30 characters in a cell

    Hi there:
    I am working on an excel file that I will later need to concatenate and save into a text file. As part of this, I need to get one column to have 30 character spaces in it, even if I have less than 30 characters of data in the cell. Anyone know how I can do that?

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,082

    Re: need exactly 30 characters in a cell

    Use a Helper column with this formula

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

    Which means take A1 add 30 spaces to it, take the first 30 characters so the result will always have 30 characters
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    01-12-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: need exactly 30 characters in a cell

    Quote Originally Posted by Special-K View Post
    Use a Helper column with this formula

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

    Which means take A1 add 30 spaces to it, take the first 30 characters so the result will always have 30 characters
    Thanks! I copied exactly that formula into the cell in the next column, no dice.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: need exactly 30 characters in a cell

    Hi Scottrontondo,

    Welcome to the forum.

    If you need 30 spaces in the cell not matter if the cell has something or not, use following formula:-

    Please Login or Register  to view this content.
    If you want all the characters of the cell and deficiency to make 30 chars to be filled by spaces, use following formula:-

    Please Login or Register  to view this content.
    If you want just 30 characters only where deficit will be filled by zeros, use following formula:-


    Please Login or Register  to view this content.
    All above example assumes you want to append (padd) zeros on the right side of the text.
    If you still have issues, post your sample file with little explanation. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  5. #5
    Registered User
    Join Date
    01-12-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: need exactly 30 characters in a cell

    actually, I just need blank spaces on the right side of the text, to get to 30 character spaces total for the cell. So, if there's 15 characters of data, I will need 15 blank spaces after that, to get to 30.

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: need exactly 30 characters in a cell

    Scott,

    Special-K's formula from above should work in your case. Just be sure to modify the formula correctly to suit. Did you correct the cell reference ( the A1 in his formula should match the cell you are trying to manipulate.

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: need exactly 30 characters in a cell

    Hello Scott,

    Just a small change in Special-K's formula, use like

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

    Change reference accordingly.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  8. #8
    Registered User
    Join Date
    01-12-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: need exactly 30 characters in a cell

    thanks! think I am all set now. Thank you all!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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