Google Sheets function · Filter and sort
FILTER in Google Sheets: syntax and examples
FILTER keeps the rows (or columns) of a range for which every condition is TRUE. The result is a live array that spills into the cells below and beside the formula, so those cells must be empty.
Syntax
FILTER(range, condition1, [condition2])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
range | range | yes | The data to filter. Rows or columns that fail a condition are dropped. |
condition1 | boolean | yes | A column or row of TRUE/FALSE values, as tall as range (for example C2:C6>100). |
condition2 | boolean | no | More conditions of the same size. A row is kept only if all of them are TRUE. |
Examples
The examples use this table, starting in A1:
| Name | Team | Sales | Region |
| Ana | A | 120 | North |
| Bob | B | 80 | South |
| Cris | A | 200 | North |
| Dan | B | 50 | North |
| Eva | A | 90 | South |
=FILTER(A2:D6, B2:B6="A")Result:
| Ana | A | 120 | North |
| Cris | A | 200 | North |
| Eva | A | 90 | South |
All rows of team A. The result spills down and to the right from the formula cell.
Run in a Google Sheet (English US locale) on .
=FILTER(A2:A6, C2:C6>100)Result:
| Ana |
| Cris |
Names of people with sales above 100. Only column A is returned, tested against column C.
Run in a Google Sheet (English US locale) on .
=FILTER(A2:C6, B2:B6="A", D2:D6="North")Result:
| Ana | A | 120 |
| Cris | A | 200 |
Two conditions work as AND: team A and region North.
Run in a Google Sheet (English US locale) on .
=FILTER(A2:A6, (B2:B6="B")+(D2:D6="South"))Result:
| Bob |
| Dan |
| Eva |
OR logic: adding the two TRUE/FALSE columns keeps a row when either one is true.
Run in a Google Sheet (English US locale) on .
=IFERROR(FILTER(A2:A6, C2:C6>1000), "no match")Result: no match
No row passes the test. IFERROR replaces the #N/A with your own text.
Run in a Google Sheet (English US locale) on .
Common errors
- When no row matches, FILTER returns #N/A instead of an empty result. Wrap it in IFERROR to show a message or an empty string.
- Every condition must have the same height as range. Testing C2:C5 against A2:A6 returns #N/A.
- The cells where the result spills must be empty, otherwise the formula shows #REF!. Keep the area below and to the right clear.
- There is no OR argument. Add the conditions with + for OR, and multiply them with * or list them as separate arguments for AND.
Compared with Excel
Same syntax as Excel FILTER, which has an extra if_empty argument. In Sheets you use IFERROR instead.
Questions and answers
Can FILTER match several values at once?
Yes. Combine tests with + for OR, or test against a list with COUNTIF or MATCH inside the condition.