+ Reply to Thread
Results 1 to 13 of 13

searchign for multple combination of string text

  1. #1
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    searchign for multple combination of string text

    Hello

    Let's say I have the following list
    abc
    def
    ghi
    jkl

    And in another column I have cells (each line in one cell) that may contain a combination of the above and other strings that are not part of the list.

    abc tyr eyw
    aja abc tye
    fhw swe ghi

    and so on.

    Is there a way to search inside each of the above cell for the string in the list, and return the found string?

    Thanks!
    Last edited by adamg6; 02-20-2013 at 12:04 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: searchign for multple combination of string text

    With your second list starting in D1, try this array formula (enter with CNTRL SHFT ENTER rather than ENTER)

    =INDEX($A$1:$A$4,MATCH(0,--EXACT(D1,SUBSTITUTE(D1,$A$1:$A$4,"")),0))
    See attachment
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

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

  3. #3
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    Re: searchign for multple combination of string text

    That's great! Thanks a lot.

    What if the cell contained multiple matches? Is there a way to pull all the matches into separate cells?


    I appreciate your help

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: searchign for multple combination of string text

    IF A & B are your data columns, try this formula.


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    Re: searchign for multple combination of string text

    Sorry- how would I use that in conjunction with what ChemistB provided me?



    Quote Originally Posted by kvsrinivasamurthy View Post
    IF A & B are your data columns, try this formula.


    Please Login or Register  to view this content.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: searchign for multple combination of string text

    Post an actual workbook with sample data, and a manual mockup of the desired results you're trying to achieve. This enables others to quickly assist on an actual target. Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  7. #7
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    Re: searchign for multple combination of string text

    Please see attached.

    Thank you

    Test workbook.xlsx

  8. #8
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: searchign for multple combination of string text

    If you are OK to place them in a separate cells,

    E2, with CTRL+SHIFT+ENTER,

    =IFERROR(INDEX($A:$A,SMALL(IF(ISNUMBER(SEARCH($A$2:$A$9,$D2)),ROW($A$2:$A$9)),COLUMNS($E2:E2))),"")

    Then copy across.

    If order is NOT an issue, with just ENTER in E2,

    =IFERROR(LOOKUP(9.9E+300,SEARCH($A$2:$A$9,$D2)/ISNA(MATCH($A$2:$A$9,$D2:D2,0)),$A$2:$A$9),"")

    Then copy across.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: searchign for multple combination of string text

    Pl see the attached file.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    Re: searchign for multple combination of string text

    Thanks Haseeb it worked, thanks everyone for your help.

  11. #11
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    Re: searchign for multple combination of string text

    Would it be possible to create a formula that would pull all the strings of text in a cell that are not part of a list?


    Test workbook 2.xlsx

    Thanks!

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: searchign for multple combination of string text

    I would use VBA for this to add a new function into your Excel. This function would be used like any other formula, you're just installing it yourself.

    Please Login or Register  to view this content.
    How to install the User Defined Function:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook (test workbook.xlsm)

    The function is installed and ready to use.

    ============

    The function is used like so in cell E2:

    =UniqueWords(D2, $A$2:$A$9)

    First Parameter = The cell with the string to extract words from
    Second Parameter = the range of cells listing your words to remove from the string
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    08-03-2011
    Location
    toronto
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    11

    Re: searchign for multple combination of string text

    Great, that really helps

+ 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