FILTER
Filters rows from an array using a Boolean include mask.
FILTER returns only rows where the include condition evaluates to true.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=FILTER(array, include, [if_empty])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
array | range (range) | Required | — |
include | range (range) | Required | — |
if_empty | any | Optional | — |
Remarks
includemust have the same row count asarray, or a single row used as broadcast.- A row is kept if any include cell for that row is truthy.
- If no rows match,
if_emptyis returned when supplied; otherwise#CALC!. - Results spill as dynamic arrays.
Error cases
- Dimension mismatches return
#VALUE!.
Examples
Keep two rows according to a Boolean selector.
Formula =FILTER({10;20;30},{TRUE;FALSE;TRUE})
Expected result {10; 30}
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Supply a text fallback for an empty filtered result.
Formula =FILTER({10;20;30},{FALSE;FALSE;FALSE},"No match")
Expected result No match
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Filter the smallest nonempty array with one true condition.
Formula =FILTER({10},{TRUE})
Expected result 10
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
An empty result without a fallback returns an error.
Formula =FILTER({10;20;30},{FALSE;FALSE;FALSE})
Expected result #CALC!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Filter active records
Formula =FILTER(A1:A3,B1:B3)
| A | B | |
|---|---|---|
| 1 | "Ana" | TRUE |
| 2 | "Bo" | FALSE |
| 3 | "Cy" | TRUE |
Expected result {"Ana"; "Cy"}
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Return fallback when no rows match
Formula =FILTER(A1:A2,B1:B2,"No matches")
| A | B | |
|---|---|---|
| 1 | 10 | FALSE |
| 2 | 20 | FALSE |
Expected result No matches
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What happens when include has no TRUE rows?
FILTER returns if_empty when provided; otherwise it returns #CALC! to signal an empty result set.
How strict is include shape matching?
include must match array row count or be a single broadcast row; incompatible dimensions return #VALUE!.