0% found this document useful (0 votes)
255 views

How To Use The Excel FILTER Function - Exceljet

The FILTER function filters a range of data based on supplied criteria and extracts matching records. It takes three arguments: array, include, and if_empty. Array is the range or data to filter. Include contains logical tests as criteria to match values in array. If_empty specifies the return value when no matches are found. FILTER returns a dynamic array of filtered values that update automatically when source data changes.

Uploaded by

Aishwarya Raju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
255 views

How To Use The Excel FILTER Function - Exceljet

The FILTER function filters a range of data based on supplied criteria and extracts matching records. It takes three arguments: array, include, and if_empty. Array is the range or data to filter. Include contains logical tests as criteria to match values in array. If_empty specifies the return value when no matches are found. FILTER returns a dynamic array of filtered values that update automatically when source data changes.

Uploaded by

Aishwarya Raju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

Advertisement


Functions
FILTER Function

EXCEL 2021
DYNAMIC ARRAY

FILTER Function
Related functions 

UNIQUE
FILTER
SORT
SORTBY
RANDARRAY
SEQUENCE

Summary

https://exceljet.net/functions/filter-function 1/15
11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

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

Advertisement

Purpose 

Filters range with given criteria

Return value 

Array of filtered values

Arguments 

array - Range or array to filter.


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

Syntax 

=FILTER(array, include, [if_empty])

https://exceljet.net/functions/filter-function 2/15
11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

Usage notes 
The FILTER function "filters" a range of data based on supplied criteria. The result is
an array of matching values from the original range. In plain language, the FILTER
function will extract matching records from a set of data by applying one or more
logical tests. Logical tests are supplied as the include argument and can include many
kinds of formula criteria. For example, FILTER can match data in a certain year or
month, data that contains specific text, or values greater than a certain threshold.

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.

Video: FILTER function basic example

Basic example

To extract values in A1:A10 that are greater than 100:

= FILTER(A1:A10,A1:A10 > 100)

To extract rows in A1:C5 where the value in A1:A5 is greater than 100:

= FILTER(A1:C5,A1:A5 > 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

https://exceljet.net/functions/filter-function 3/15
11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

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:

= 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")

No matching data

https://exceljet.net/functions/filter-function 4/15
11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

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:

= FILTER(range,logic) // #CALC! error

Often, is_empty is configured to provide a text message to the user:

= FILTER(range,logic,"No results") // display message

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

= FILTER(range,logic,"") // display nothing

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:

= FILTER(rng1,ISNUMBER(SEARCH("txt",rng2)))

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:

https://exceljet.net/functions/filter-function 5/15
11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

= FILTER(rng1,MONTH(rng2) = 7,"No data")

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:

= FILTER(range,(color = "red") * (score > 80),"No results")

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.

= FILTER(data,(LEFT(account) = "x") *
(region = "east") * NOT(MONTH(date) = 4))

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

1. FILTER can work with both vertical and horizontal arrays.


2. The include argument must have dimensions compatible with the array
argument, otherwise FILTER will return #VALUE!
3. If the include array includes any errors, FILTER will return an error.

https://exceljet.net/functions/filter-function 6/15
11/9/22, 2:53 AM How to use the Excel FILTER function | Exceljet

Advertisement

AUTHOR

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.

Related Information

https://exceljet.net/functions/filter-function 7/15

You might also like