+ Reply to Thread
Results 1 to 5 of 5

Delimit string to columns after using TRIM?

Hybrid View

  1. #1
    Registered User
    Join Date
    04-11-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    15

    Delimit string to columns after using TRIM?

    Okay, so I have a row of data with lots of spaces between characters, simple to use TRIM to remove all but 1 space between each 'column' in the cell. Can I use an array formula or macro to transfer each 'column' of data within that cell to an actual column?

    Example:

    92,481      4,466      4,436     18,454     20,113        896     17,399    102,362     10,318      9,810      1,316        538     28,788     38,674
    Gets TRIM'd down to:

    92,481 4,466 4,436 18,454 20,113 896 17,399 102,362 10,318 9,810 1,316 538 28,788 38,674
    With spaces in between. I can't use LEFT/MID because if say, the first 'column' changes to 101,451 upon data refresh I will lose characters.

    Basically I want to take the TRIM version and convert to columns automatically


    Column1        Column2
    92,481          4,466
    ....etc
    Last edited by peepingtom; 04-27-2013 at 08:05 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,662

    Re: Delimit string to columns after using TRIM?

    Data..Text to Columns is one option
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-11-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Delimit string to columns after using TRIM?

    Yes but I need it to do it automatically. Can you point me to VBA or something that would do so?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,959

    Re: Delimit string to columns after using TRIM?

    I recored this in about 15 seconds, and you dont even need to remove spaces, T2C does it all for you

    Sub Slit_to_columns()
    '
    ' Slit_to_columns() Macro
    '
        Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
            TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
            Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
            :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
            Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1 _
            ), Array(14, 1)), TrailingMinusNumbers:=True
    End Sub
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,959

    Re: Delimit string to columns after using TRIM?

    You could write your own macro, using the macro recorder. If you have not used it before, practice a few times using T2C, the click the macro record button - next to READY at the botton left corner

    do what you want, it will be recorded into a macro. click again when you are finished. Then create a "shape" and allocate the macro to that, you will then have a macro button

+ 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