+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Finding substring in array of possible strings

  1. #1
    Registered User
    Join Date
    12-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Finding substring in array of possible strings

    Hello,

    I need a formula to search for a substring in an array of possible strings, then output the matching string.

    Example:

    Col A contains the substrings I'm looking for:

    BLACK
    BLUE
    GREEN
    ORANGE
    PURPLE
    RED
    WHITE
    YELLOW

    Col B will output the matching string it finds

    Col C has the array of possible string matches, for example:

    Conduct IMT - (RED)
    Conduct IMT - Group 101A (BLUE, YELLOW, PURPLE)
    GREEN - Conduct IMT - Group 14
    Attend Meeting - Group 16 - WHITE, BLACK, ORANGE

    So, I want the formula in Col B to tell me for the first one in Col A (Black), it will output the string "Attend Meeting - Group 16 - WHITE, BLACK, ORANGE"

    Thanks very much!
    Last edited by kkerr; 01-06-2011 at 03:01 PM.

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

    Re: Finding substring in array of possible strings

    Assuming data starts in Row2, then in B2:

    =INDEX($C$2:$C$5,MATCH("*"&A2&"*",$C$2:$C$5,0))

    copied down.
    Where there is a will there are many ways.

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

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

  3. #3
    Registered User
    Join Date
    12-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Thumbs up Re: Finding substring in array of possible strings

    This worked beautifully! Many thanks!

  4. #4
    Registered User
    Join Date
    07-03-2012
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Finding substring in array of possible strings

    When the string length exceed 255 characters, the MATCH function will error out.

    For example, let's say I have in column A a list of authors. In column B, I have a quotation from each author that is longer than 255 characters.

    In C1, I type a short sub-quote. In D1, I'd like to see which author wrote the text I typed into C1.

    The formula entered in D1

    {=INDEX(A1:A4,MATCH("*"&C1&"*",B1:B4,0)}

    returns #N/A if the string is longer than 255. This is entered with CTRL+SHIFT+ENTER, of course.

    I know that this is a fundamental limit on several of Excel's functions. Any ideas on a work-around?

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

    Re: Finding substring in array of possible strings

    Please start your own new thread.

+ 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.6.0 RC 1