+ Reply to Thread
Results 1 to 6 of 6

Thread: extract from a string.

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    Est
    MS-Off Ver
    Excel 2003
    Posts
    3

    extract from a string.

    I need to take out parts from a string, and place them in different cells.
    String as follow
    dfd://aas:hadd3a8py@dsdd.usuos.cos.es/ rrtt://aas.csd-wwb.ew/
    dfd://georg:hnk738py@dfd.usuos.cos.es/ rrtt://georg.csd-wwb.ew/

    need to put in cell1 aas, cell2 hadd3a8py, cell3 dsdd.usuos.cos.es cell4 rrtt://georg.csd-wwb.ew

    The same for the second string.

    Please note that words could be small and long only thing that are the same are separators.

    How to cut these? Please help.
    Thank you.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: extract from a string.

    Try:

    =MID(A1,FIND("//",A1)+2,FIND(":",A1,FIND("//",A1))-FIND("//",A1)-2)
    =LEFT(MID(A1,FIND(B1&":",A1)+LEN(B1)+1,255),FIND("@",MID(A1,FIND(B1&":",A1)+LEN(B1)+1,255))-1)
    =LEFT(MID(A1,FIND(C1&"@",A1)+LEN(C1)+1,255),FIND("/",MID(A1,FIND(C1&"@",A1)+LEN(C1)+1,255))-1)
    =LEFT(MID(A1,FIND(D1&"/",A1)+LEN(D1)+2,255),LEN(MID(A1,FIND(D1&"/",A1)+LEN(D1)+2,255))-1)
    in B1:D1, respectively, and copy down
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    03-02-2011
    Location
    Est
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: extract from a string.

    Oh wow Thank you so MUCH!!!

  4. #4
    Registered User
    Join Date
    03-02-2011
    Location
    Est
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: extract from a string.

    I see that each next string depends on previous. I need that each uses A1and don't depend on others.
    Could you do that please?

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: extract from a string.

    Why can't they depend on previous?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  6. #6
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: extract from a string.

    Hi rakun,
    Be careful what you ask for. Put your string in A1 and the following in B1 and drag the formula to the right.
    See if this gives you the results you want.
    =TRIM(MID(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$1,"//"," "),":"," "),"@"," "))," ",REPT(" ",LEN(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$1,"//"," "),":"," "),"@"," "))))),LEN(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$1,"//"," "),":"," "),"@"," ")))*(COLUMN()-1),LEN(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$1,"//"," "),":"," "),"@"," ")))))
    As I saved the answer it said that Excel 2003 will not support more than 7 levels of nesting. So here is your formula that will work in a single cell but you need to upgrade to a newer version of Excel.

    I like NBVC's answer better. Why can't it depend on previous? My formula above depends on the column the formula is in, so previous makes sense to me.
    Attached Files Attached Files
    Last edited by MarvinP; 03-03-2011 at 10:14 AM. Reason: Dislexia retype
    One test is worth a thousand opinions.
    Click the * below to say thanks.

+ 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.2.0