+ Reply to Thread
Results 1 to 3 of 3

Return sub-strings between certain characters from a long string (de-concatenate)

  1. #1
    Registered User
    Join Date
    05-29-2015
    Location
    Germany
    MS-Off Ver
    2010
    Posts
    27

    Return sub-strings between certain characters from a long string (de-concatenate)

    Hi, I have a string which goes //John/McCormick/25

    The slash is used to divide the string into a few parts. Now I would like to return them, i.e. to de-concatenate and retrieve:

    *nothing ("") for the first position,
    *"John" for the second position,
    *"McCormick" for the third position, and
    *"25" for the fourth position.

    If I was able to retrieve position of slashes within the string, I could use something like this:
    *MID(cell, position of the 1st slash, position of the 2nd slash)
    *MID(cell, position of the 2nd slash, position of the 3rd slash)
    *MID(cell, position of the 3rd slash, position of the 4th slash)
    *MID(cell, position of the 4th slash, position of the 5th slash)
    Last edited by regresss; 06-07-2015 at 08:15 AM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Return sub-strings between certain characters from a long string (de-concatenate)

    hi regresss. assuming your data in A1, try this in B1:
    =TRIM(MID(SUBSTITUTE($A1,"/",REPT(" ",100)),100+(COLUMNS($B1:B1)-1)*100,100))

    then copy to C1 & D1. it's explained in the file of my link below*Tips & Tutorials I Compiled, sheet 12

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    05-29-2015
    Location
    Germany
    MS-Off Ver
    2010
    Posts
    27

    Re: Return sub-strings between certain characters from a long string (de-concatenate)

    Nice and neat solution benishiryo. I will gladly use yours as I expect it to be faster then mine for big data (and I plan to move horizontally). Mine (I have come up with in the meantime):

    A1: //John/McCormick/25

    =MID(A1,FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),1))+1,FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),24))-FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),1))-1)
    =MID(A1,FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),2))+1,FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),3))-FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),2))-1)
    =MID(A1,FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),3))+1,FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),4))-FIND(CHAR(120),SUBSTITUTE(F3,"/",CHAR(120),3))-1)
    Last edited by regresss; 06-07-2015 at 08:46 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 9
    Last Post: 03-09-2015, 10:15 PM
  2. Concatenate Long String Help Request
    By dbsbender in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-22-2014, 01:57 PM
  3. [SOLVED] Merge multiple cells in a column to strings no more than 100 characters long
    By exceler_52 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2013, 01:49 PM
  4. Replies: 1
    Last Post: 10-19-2011, 07:48 AM
  5. [SOLVED] How parse out characters from long string?
    By Chet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2006, 06:10 PM

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