+ Reply to Thread
Results 1 to 3 of 3

match any string in a cell?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    15

    match any string in a cell?

    Hi,

    I´m looking for a way to do a lookup on every word found in a cell against a value-pair map.

    LIST1:

    big truck
    my dog is brown

    LIST2: - value-pair list which maps a word with a category
    dog | animal
    truck | vehicle


    I want to create a formula which tries to match all the cells with all their substrings located in LIST1, with LIST2.

    The final output would be:
    big truck | vehicle
    my dog is brown | animal


    I have found many hits when searching for a solution. But the partial matching have always been the "other way around". That is, the partial matching have been applied to LIST2, where I want to partial matching to occur in LIST1.

    This the formula I´ve used: =INDEX(LIST2;MATCH("*"&A_CELL&*";LEFT_COLUMN_OF_LIST2;0);2)

    Any clues on how I can reach a solution?

    Thanks!

    /Erik

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: match any string in a cell?

    You could perhaps using something along the lines of:

    B2:
    =INDEX($D$1:$D$2;MATCH(TRUE;INDEX(ISNUMBER(SEARCH($C$1:$C$2;$A2));0);0))
    copied down
    where

    A2, A3 etc holds strings (LIST1)
    C1:D2 is your pair listing (LIST2)
    Modify ranges to suit of course though note the above will return only the first keyword (not multiple)... eg:

    "My truck is a dog to drive"

    would return "animal" given this is listed first in List2 (ie has preference)

  3. #3
    Registered User
    Join Date
    07-07-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: match any string in a cell?

    It works! Thanks a lot DonkeyOte! I barely could go to sleep yesterday because I was so angry I couldn´t figure out the formula =)

+ 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