+ Reply to Thread
Results 1 to 9 of 9

split of string with multiple section of various size spaces

  1. #1
    Registered User
    Join Date
    04-30-2009
    Location
    tokyo
    MS-Off Ver
    Excel 2016
    Posts
    42

    split of string with multiple section of various size spaces

    Hello,

    I have this string that has multiple uneven number of spaces, such as a$=”asdasd utyutyu awer “
    I need to extract the 3 non-empty strings t(0)=” asdasd”,t(1)=” utyutyu” and t(2)=” awer”.
    I f I use T=split(a$,” “) I get the non-empty strings but also all the spaces as members of the array t.
    Any ideas?

    Thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: split of string with multiple section of various size spaces

    Have you tried Data: Text To Columns, specifying the space as a delimiter?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: split of string with multiple section of various size spaces

    When I use Split(a$, " ") on the string I only get the 3 non-empty strings.

    I can only replicate what you describe if I add some extra spaces inbetween the non-empty strings.
    If posting code please use code tags, see here.

  4. #4
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: split of string with multiple section of various size spaces

    The double qoutes are wrong.

    The standard delimeter of split = " "


    Please Login or Register  to view this content.
    Kind regards, Harry.

  5. #5
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: split of string with multiple section of various size spaces

    Despite that you have little or never responds.

    A other solution.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-30-2009
    Location
    tokyo
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: split of string with multiple section of various size spaces

    in yor example do I need to knwo a priori that I have 3 strings? what if I do not know that in the full string I have 3 substrings?

  7. #7
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: split of string with multiple section of various size spaces

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-30-2009
    Location
    tokyo
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: split of string with multiple section of various size spaces

    thanks,
    now where is the data? I look at "A1" and there is nothing there. I assume I am missing something, sorry

  9. #9
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: split of string with multiple section of various size spaces

    See example and run code hsv().
    Attached Files Attached Files
    Last edited by HSV; 03-29-2013 at 06:28 PM.

+ 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