+ Reply to Thread
Results 1 to 8 of 8

Grab specific string from one cell and post it in another.

Hybrid View

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    Mullsjö, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    4

    Grab specific string from one cell and post it in another.

    Hi.

    I have a cell that contains a path in a windows structure. In the path there is
    a specific type of value that I would like to grab and post in another column.

    Examples in column A:
    C:\Folder1\Folder2\G000111\Folder3\test.doc
    C:\Folder1\Folder2\G002111\Folder3\test.xls
    C:\Folder11\Folder22\G000111 Sweden\Folder33\test.jpg

    Now I would like to grab the "G00***" name and put it in column B.
    One rule to be applied is that the folders names allways starts with "G00" (G, zero, zer0)

    Is this possible to to since the names and the position in the string varies, so I can't set
    a count for it to read from left X digits forward?

    Many thanks in advance.

    /Gherry

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Grab specific string from one cell and post it in another.

    A1 = text string of folder name & path
    B1 = RIGHT(A1, LEN(A1) - SEARCH("G00", A1, 1) +1)
    like that?

    EDIT:
    C1 = LEFT(B1, SEARCH("\", B1, 1) -1)
    or like that?
    Last edited by ben_hensel; 09-12-2012 at 04:06 PM.

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Grab specific string from one cell and post it in another.

    Alternate formula:
    =TRIM(LEFT(SUBSTITUTE(MID(A1,SEARCH("G00",A1),255),"\",REPT(" ",99)),99))
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    09-12-2012
    Location
    Mullsjö, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Grab specific string from one cell and post it in another.

    I'm a total noob at Excel, and maybe that is the reason I get an error on all of you guys suggested solutions.
    None of them work, or rather, is accepted by Excel.

    /Gherry

  5. #5
    Forum Contributor
    Join Date
    08-23-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Grab specific string from one cell and post it in another.

    Try this one...
    =MID(A1,FIND("G000",A1,1),(FIND("\",A1,FIND("G000",A1,1))-FIND("G000",A1,1)))

  6. #6
    Registered User
    Join Date
    09-12-2012
    Location
    Mullsjö, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Grab specific string from one cell and post it in another.

    All your posts worked fine, after some tips from vlady, but nested.if1:s worked the best.

    I'm not that good at code but I can see that you break the find with "\" which is really nice, but what do I do
    if I want to add more "breakpoints"? I really would like "\", " " and "(" also.

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Grab specific string from one cell and post it in another.

    side note:

    commas in formula don't work on the setting the op used ; instead

    thanks.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  8. #8
    Registered User
    Join Date
    09-12-2012
    Location
    Mullsjö, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Grab specific string from one cell and post it in another.

    Sorry for being a bit messy, but I really want to learn.

    I used =MID(A1,FIND("G000",A1,1),(FIND("\",A1,FIND("G000",A1,1))-FIND("G000",A1,1))) and what
    I want now is for someone to explain to me what happens in this formula, piece by piece.
    Does someone have the time?

    Also: I really would like a formula that grabs the information between "\" number two and "\" number three
    and present it in another column. As in example "C:\Folder11\Folder22\G000111 Sweden\Folder33\test.jpg"
    it would be "Folder22". I can't search for it by name this time, since that varies.

    /Gherry

+ 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