# Excel FILTER Function

The Excel FILTER function filters a range of data based on supplied criteria, and extracts matching records.

**array**- Range or array to filter.**include**- Boolean array, supplied as criteria.**if_empty**- [optional] Value to return when no results are returned.

The Excel FILTER function "filters" a range of data based on supplied criteria. The result is an array of matching values the original range. When this array is the final result (i.e. the results are not handed off to another function) matching results will "spill" on to the worksheet. In simple language, the FILTER function allows you to easily extract matching records from a larger set of source data based on criteria you provide.

The results from FILTER are *dynamic*. When values in the source data change, or the source data array is resized, the results from FILTER will update automatically.

### Example

In the example shown, the formula in F5 is:

=FILTER(B5:D14,D5:D14=H2,"No results")

Since the value in H2 is "red", the FILTER function extracts data from **array** where the Group column contains "red". All matching records are returned to the worksheet starting from cell F5, where the formula exists.

Values can be hardcoded as well. The formula below has the same result as above with "red" hardcoded into the criteria:

=FILTER(B5:D14,D5:D14="red","No results")

To return nothing when no matching data is found, supply an empty string ("") for **if_empty**:

=FILTER(B5:D14,D5:D14=H2,"")

### More than one criteria

The **include** argument can be extended with boolean logic. For example, to extract only data where the group is "red" and score is greater than 80, you can use a formula like this:

=FILTER(B5:D14,(D5:D14="red")*(C5:C14>80),"No results")

Building criteria with logical expressions is an elegant and flexible approach. For more examples of the kind of criteria you can construct with boolean expressions, see examples on our SUMPRODUCT function page.

### Notes

- Filter can work with both vertical and horizontal arrays.
- The
**include**argument must have a dimension compatible with the**array**argument, otherwise filter will return #VALUE! - If the
**include**array includes any errors, FILTER will return an error. - If FILTER is used between workbooks, both workbooks must be open, otherwise FILTER will return #REF!.

## Download 200+ Excel Shortcuts

Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.