Excel Office

Excel How Tos, Tutorials, Tips & Tricks, Shortcuts

Check if range contains a value not in another range in Excel

To test if a range contains any values (i.e. at least one value) not in another range, you can use the SUMPRODUCT function with MATCH and ISNA.

The MATCH function receives a single lookup value, and returns a single match if any. In this case, however, we are giving MATCH an array for lookup value, so it will return an array of results, one per element in the lookup array.

Worked Example:   Count dates in given year in Excel

See example below:




In the example shown, the formula in F6 is:


How the formula works

MATCH is configured for “exact match”. If a match isn’t found, MATCH will return the #N/A error. After match runs, it returns have something like this:


We take advantage of this by using the ISNA function to test for any #N/A errors.

Worked Example:   How to add sequential row numbers to a set of data in Excel

After ISNA, we have:


We use the double negative (double unary) operator to convert TRUE FALSE values to ones and zeros, which gives us this:


SUMPRODUCT then sums the elements in the array, and the result is compared to zero for force a TRUE or FALSE result.

Worked Example:   How to check if cell contains one of many things in Excel


Leave a Reply

Your email address will not be published. Required fields are marked *