+ Reply to Thread
Results 1 to 4 of 4

Find if *any* value on one list exists on another

  1. #1
    Registered User
    Join Date
    07-30-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    83

    Find if *any* value on one list exists on another

    Hello,

    I am trying to develop a formula to check if any item on List 1 exists on List 2, for example:

    List 1: Apples, Bananas, Oranges
    List 2: Broccoli, Carrots, Bananas

    I would like this formula to return TRUE as Bananas exists on both lists.

    The challenge being that I don't want to rely on a "helper" column, where I simply do a INDEX/MATCH on each record in a helper column, and if the resulting sum is greater than 0, then we win!

    However, I did want to apply that above logic as an array formula, and so I tried something simple-minded like ={SUM(MATCH(A2:A100,B2:B9000,0))} entered with CSE. This is returning an error, and I assume it is due to entering an array for the first argument in the MATCH. Any words of wisdom would be greatly appreciated, and I am not opposed to formula-writing or macros if a formulaic approach isn't feasible.

    Thank you for your help,
    Yogi

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

    Re: Find if *any* value on one list exists on another

    Try this regular formula:
    =COUNT(INDEX(MATCH(A2:A100,B2:B9000,0),0))>0

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    07-30-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: Find if *any* value on one list exists on another

    Yes! Thank you. Now it makes sense; the MATCH was doing as I asked with the list in the first argument, but it's not a legal maneuver to try to sum an array that is loaded with plenty of "#N/A"s and the like.

    I'd be interested to learn what the INDEX function is bringing to the party in your formula. I can see it working (and conversely, NOT working in its absence), but I haven't quite wrapped my head around it.

    Thank you again for your fast response.

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

    Re: Find if *any* value on one list exists on another

    In many situations where a formula would typically be an array-formula (completed by pressing CTRL+SHIFT+ENTER, instead of just ENTER),
    wrapping certain parts of those formulas in an INDEX function causes Excel to properly interpret the array...without C+S+E. It may take a bit of trial and error to find the correct section, but in my opinion it's worth the effort. Nobody I work with *ever* remembers to C+S+E array-formulas after editing them.

+ 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