Filter values in array formula

Summary
To filter a data in an array formula (to exclude or require certain values), you can use an array formula based on the IF, MATCH, and ISNUMBER functions.
In the example shown, the formula in H5:
where "data" is the named range B4:D11 and "filter" is the named range F4:F6.
Note: this is an array formula and must be entered with control + shift + enter.
Explanation
- The MATCH function checks all values in the named range "data" against values in "filter"
- ISNUMBER converts matched values to TRUE and non-matched values to FALSE
- IF uses the array output in #2 above to filter values, excluding values in "filter"
The final array looks like this:
{1,FALSE,3;FALSE,4,FALSE;FALSE,FALSE,FALSE;1,FALSE,3;FALSE,FALSE,FALSE;3,FALSE,FALSE;FALSE,4,FALSE;FALSE,FALSE,4}
COUNT is only used to verify the result.
Filter to exclude
In cell H6 the formula has been modified to exclude values using 1-ISNUMBER like so:
This effectively reverses the array output in step #2 above.
Download 200+ Excel Shortcuts
Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.