The FILTER function takes three arguments: array, include, and if_empty. Array is the range or array to filter. The include argument should consist of one or more logical tests. These tests should return TRUE or FALSE based on the evaluation of values from array. The last argument, if_empty, is the result to return when FILTER finds no matching values. Typically this is a message like “No records found”, but other values can be returned as well. Supply an empty string ("") to display nothing. 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. Results from FILTER will “spill” onto the worksheet into multiple cells.

### Basic example

To extract values in A1:A10 that are greater than 100: To extract rows in A1:C5 where the value in A1:A5 is greater than 100: Notice the only difference in the above formulas is that the second formula provides a multi-column range for array. The logical test used for the include argument is the same. Note: FILTER will return a #CALC! error if no matching data is found

### Filter for Red group

In the example shown above, the formula in F5 is: 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:

### No matching data

The value for is_empty is returned when FILTER does not find matching results. If a value for if_empty is not provided, FILTER will return a #CALC! error if no matching data is found: Often, is_empty is configured to provide a text message to the user: To display nothing when no matching data is found, supply an empty string ("") for if_empty:

### Values that contain text

To extract data based on a logical test for values that contain specific text, you can use a formula like this: In this formula, the SEARCH function is used to look for “txt” in rng2, which would typically be a column in rng1. The ISNUMBER function is used to convert the result from SEARCH into TRUE or FALSE. Read a full explanation here.

### Filter by date

FILTER can be used with dates by constructing logical tests appropriate for Excel dates. For example, to extract records from rng1 where the date in rng2 is in July you can use a generic formula like this: This formula relies on the MONTH function to compare the month of dates in rng2 to 7. See full explanation here.

### 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: where color and score are columns in range.

### Complex criteria

To filter and extract data based on multiple complex criteria, you can use the FILTER function with a chain of expressions that use boolean logic. For example, the generic formula below filters based on three separate conditions: account begins with “x” AND region is “east”, and month is NOT April. See this page for a full explanation. Building criteria with logical expressions is an elegant and flexible approach that can be extended to handle many complex scenarios. See below for more examples.

### Notes

### Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.