+ Reply to Thread
Results 1 to 6 of 6

Formula to indicate when a text string appears in an array

  1. #1
    Registered User
    Join Date
    02-10-2013
    Location
    Frankfurt, Germany
    MS-Off Ver
    Excel 2003
    Posts
    57

    Formula to indicate when a text string appears in an array

    Hi,

    I have a long list of terms, and I need to identify which of these terms appear in another body of text strings. Rather than searching for each individual term, is there a formula that check the terms for me automatically.

    The terms will appear in the larger body of text, but they won't appear on their own, so they won't be perfect matches. I've attached a sheet to try to illustrate the problem.
    Attached Files Attached Files

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula to indicate when a text string appears in an array

    try
    =IF(B2="","",IF(ISNUMBER(LOOKUP(10^99,SEARCH(B2,$A$2:$A$12))),"yes","no"))
    or even
    =IF(COUNTIF($A$2:$A$12,"*"&B2&"*"),"yes","no")
    Last edited by martindwilson; 06-30-2014 at 08:55 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  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

    Re: Formula to indicate when a text string appears in an array

    Using your posted workbook, this regular formula, copied down, returns Yes if any of the list terms exists in the referenced cell...otherwise: No
    Please Login or Register  to view this content.
    OOPS! I got the logic reversed.
    THIS regular formula, copied down, returns Yes if the Col_B term exists in any of the Col_A values
    Please Login or Register  to view this content.
    Note: I edited that formula to fix a relative reference error.

    Is that something you can work with?
    Last edited by Ron Coderre; 06-30-2014 at 09:02 AM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    02-10-2013
    Location
    Frankfurt, Germany
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Formula to indicate when a text string appears in an array

    Thanks a lot! I'm not having much luck with this though. I've pasted it wholesale into column C. The references seem to be correct, but I just get the error dialogue box.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula to indicate when a text string appears in an array

    =IF(B2<>"";IF(COUNTIF($A$2:$A$12;"*"&B2&"*");"Yes","No");"")
    try using ; instead of ,
    or maybe
    =WENN(B2<>"";WENN(ZÄHLENWENN($A$2:$A$12;"*"&B2&"*");"Yes","No");"")
    Last edited by martindwilson; 06-30-2014 at 09:11 AM.

  6. #6
    Registered User
    Join Date
    02-10-2013
    Location
    Frankfurt, Germany
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Formula to indicate when a text string appears in an array

    Thanks all for you help. Unfortunately, I was unfamiliar with the methods which you explained, so I couldn't adapt them. I think I did find a solution though:

    =VLOOKUP("*"&B2&"*";A2:C12;3;FALSE)

    I added in a full column of "YES" in column C. So now I get "YES" if the term appears, if not I get N/A which suits me entirely. (To be honest, I didn't know how to use wildcards, until I saw the formulas that you provided...)

    Thanks again!

+ 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] Count # of times a text string appears
    By jscalem in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-21-2014, 04:57 PM
  2. [SOLVED] Count of Times a String Appears in an Array
    By mikealoni in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-07-2014, 11:34 AM
  3. Replies: 7
    Last Post: 11-30-2013, 09:07 AM
  4. [SOLVED] Find the last row in which a text string appears
    By dale_willey in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 06-23-2013, 10:41 PM
  5. Can an ARRAY formula return a text string?
    By Skybeau in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2013, 08:26 AM

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