+ Reply to Thread
Results 1 to 4 of 4

Need to add spaces to end of text to reach a specific amount of characters.

  1. #1
    Registered User
    Join Date
    01-23-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Need to add spaces to end of text to reach a specific amount of characters.

    I'm in need of finding a way to add additional spaces to the end of my text to reach a specific number of characters.

    For example: row 1 must equal 512 bytes (characters)

    Cell A1= can have up to 27 characters - My content is 12 characters long - I need 15 spaces to be automatically added.
    Cell B2 = can have up to 12 characters - My content is 4 characters long - I need 8 spaces to be automatically added.


    Any help will be GREATLY appreciated. I'm using Excel 2007. Thanks in advance.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Need to add spaces to end of text to reach a specific amount of characters.

    Does every row have a set amount to pad the existing string with? You could use a formula like the following - this will take the text in A1 and pad spaces to the text to make the final length 27. The other option would be to use a macro and define each row in an array that represents the final length of the string.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    01-23-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Need to add spaces to end of text to reach a specific amount of characters.

    Thanks for the reply. I will try it once I get in front of a PC later on today. A macro, wouldn't be a bad idea. Unfortunately I don't know how to create those.

  4. #4
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Need to add spaces to end of text to reach a specific amount of characters.

    because numbers cannot be input as "1234 " you must make sure the columns are set to text for it to work, you could writ that into the macro

    Please Login or Register  to view this content.

+ 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