+ Reply to Thread
Results 1 to 6 of 6

find first word within text string that matches from a list of keywords

  1. #1
    Registered User
    Join Date
    04-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    find first word within text string that matches from a list of keywords

    Hi,

    I reviewed this post http://www.excelforum.com/excel-gene...-keywords.html
    My request is slightly different.
    I have a text string that sometimes has multiple names in it.
    In the keyword list I would have all the names.
    I would like to search the text string and return the first name it finds that matches any name in the keyword list.
    It seems the above link does the opposite, it displays the names according to the order from the keyword list.

    I played around with the formula but couldnt get it to do what i want.
    Appreciate your assistance.

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: find first word within text string that matches from a list of keywords

    May be this, with CTRL+SHIFT+ENTER

    Please Login or Register  to view this content.
    A sample file would be helpful with your desired results.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Registered User
    Join Date
    04-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: find first word within text string that matches from a list of keywords

    Hi,

    Thank you for your prompt reply.
    I have attached a sample file.
    Would you be able to elaborate on your code as thus far its not working for me.

    Once again, thank you.find first word.xlsx

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: find first word within text string that matches from a list of keywords

    Using your posted workbook...
    This regular formula returns the first word in A2 that matches a word in the KEYWORDS list
    C2: =INDEX(Keywords,MATCH(MIN(INDEX(SEARCH(Keywords,A2&Keywords),0)),INDEX(SEARCH(Keywords,A2&Keywords),0),0))

    EDITED TO INCLUDE THIS COMMENT:
    The above formula assumes that at least one of the keywords will be found on the list.
    If that's not the case...
    Put the words "No Match" at the top of the KEYWORDS list and that will display when that situation exists


    Is that something you can work with?
    Attached Files Attached Files
    Last edited by Ron Coderre; 04-13-2012 at 03:22 PM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: find first word within text string that matches from a list of keywords

    Hi,

    Based on your attachment assume you are on Excel 2007 or later. If so try this with CTRL+SHIFT+ENTER.

    Please Login or Register  to view this content.
    Of course experts will have more elegant ways.

  6. #6
    Registered User
    Join Date
    04-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: find first word within text string that matches from a list of keywords

    Hi,

    The reply that Ron gave worked for me. That is what I needed.
    I wasn't able to get Haseebs code working for some reason. The CTRL+Shift+Enter didn't help.

    Either way, I appreciate the responses and I'm good to go now.

    Thank you.

+ 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