+ Reply to Thread
Results 1 to 6 of 6

Searching for multiple text strings

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    4

    Searching for multiple text strings

    Hi,

    I want to search a longer text field for a shorter string that may be within it. However, I want to do this for multiple short strings.

    For instance:

    Phrase Hidden word
    Please search the text for the hidden message: Blue
    The hidden word, Green, may be at any point
    And the word may be different lengths like Yellow

    I have a table of the hidden words (Blue, Green, Yellow, Pink)

    I know I could use search to find one word, but is there a way to look for multiple words, and return the value of which one it finds? I have many hidden words (and the list is dynamic) so I don't want to just split into multiple searches.

    Thanks in advance!!

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

    Re: Searching for multiple text strings

    Like so...
    Attached Files Attached Files
    _________________
    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!)

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Searching for multiple text strings

    Try this one

    =INDEX($E$2:$E$4,MATCH(TRUE,INDEX(ISNUMBER(SEARCH($E$2:$E$4,A2)),,),))

    Lookup using table in E2:E4

    A
    B
    C
    D
    E
    2
    Please search the text for the hidden message: Blue Blue Blue
    3
    The hidden word, Green, may be at any point Green Green
    4
    And the word may be different lengths like Yellow Yellow Yellow
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Searching for multiple text strings

    One way...

    Data Range
    A
    B
    C
    D
    E
    2
    Please search the text for the hidden message: Blue
    Blue
    ------
    ------
    Pink
    3
    The hidden word, Green, may be at any point
    Green
    Green
    4
    And the word may be different lengths like Yellow
    Yellow
    Yellow
    5
    Blue


    This formula entered in B2 and copied down:

    =IFERROR(LOOKUP(1E100,SEARCH(E$2:E$5,A2),E$2:E$5),"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    08-12-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    4

    Re: Searching for multiple text strings

    Worked perfectly, thanks all!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Searching for multiple text strings

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. [SOLVED] Formula for searching multiple text strings
    By Excelcious in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-03-2014, 06:29 PM
  2. Help searching an array of text strings for common strings
    By ABComp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-23-2012, 11:19 PM
  3. Searching for text strings within cells... how?
    By shadestreet in forum Excel General
    Replies: 5
    Last Post: 11-10-2008, 08:50 AM
  4. Searching for codes in text strings
    By Bhupinder Rayat in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-27-2006, 08:25 AM
  5. [SOLVED] searching for multiple text strings
    By eddie in forum Excel General
    Replies: 4
    Last Post: 04-10-2005, 06:06 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