1. Home
  2. Functions
  3. Array
  4. FILTER

FILTER function

Returns the rows (or columns) of a range or array that meet a condition.

Syntax

=FILTER(array, include, [if_empty])

Arguments

ArgumentRequiredDescription
arrayRequiredThe range or array to filter
includeRequiredTRUE/FALSE values, one per row (or column)
if_emptyOptionalWhat to return when nothing matches

How to use FILTER

When FILTER returns more than one value, the result spills into the cells below and to the right. Keep those cells empty, or you get #SPILL!.

FILTER takes 2 required arguments and 1 optional argument. Type =FILTER( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=FILTER({1;2;3;4}, {1;2;3;4}>2)Result 2 by 1 array
Spilled result
A
13
24
=FILTER({1;2}, {FALSE;FALSE}, "none")Result "none"
=FILTER({1;2}, {FALSE;FALSE})Result #CALC!

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.