+ Reply to Thread
Results 1 to 5 of 5

match one cell for another one that contains it

  1. #1
    Registered User
    Join Date
    05-28-2006
    Posts
    60

    match one cell for another one that contains it

    I'm trying to do a true/false for a cell that contains info from another cell:

    A1 = auto
    A2 = automobile


    This is the closest as I can get:
    =ISNUMBER(MATCH("A1",E2,0))

    I don't know how to do a "contains" function where all of A2 contains part of A1 to set it to True.

    Thanks in advance for the help! This forum is great!

  2. #2
    Pete_UK
    Guest

    Re: match one cell for another one that contains it

    You could use the SEARCH function (or FIND function if case matters) to
    see if the sub-string is contained in another string. Check out Excel
    help for further details.

    Hope this helps.

    Pete

    krayziez wrote:
    > I'm trying to do a true/false for a cell that contains info from another
    > cell:
    >
    > A1 = auto
    > A2 = automobile
    >
    >
    > This is the closest as I can get:
    > =ISNUMBER(MATCH("A1",E2,0))
    >
    > I don't know how to do a "contains" function where all of A2 contains
    > part of A1 to set it to True.
    >
    > Thanks in advance for the help! This forum is great!
    >
    >
    > --
    > krayziez
    > ------------------------------------------------------------------------
    > krayziez's Profile: http://www.excelforum.com/member.php...o&userid=34891
    > View this thread: http://www.excelforum.com/showthread...hreadid=548034



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

    I find this approach useful....

    For
    A1: Auto
    A2: Automobile

    Test if A2 contains A1:
    A3: =COUNTIF(A2,"*"&A1&"*")=1

    Test if A2 starts with A1:
    A3: =COUNTIF(A2,A1&"*")=1

    Does that give you something to work with?

    Regards,
    Ron

  4. #4
    Registered User
    Join Date
    05-28-2006
    Posts
    60
    Yep that works! So this code:
    "*"

    means that I want to use a wildcard before and after the cell value right? I wonder why I can't just use * .. I guess they'll think using * is for multiplying.

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

    That's correct.....To include the asterisk wildcard, you need to construct a text string. Hence the quotes and the ampersands (&) for string arithmetic:
    "*"&A1&"*"

    Regards,
    Ron

    (this may be a dbl-post....the ExcelTip forum popped up an error screen on the first attempt)

+ 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