The FILTER function in Google Sheets is an invaluable tool for users who need to extract specific data based on given conditions. By applying various criteria, users can refine their datasets to focus on relevant information, making analysis more efficient.
Syntax
FILTER(range, condition1, [condition2, ...])
- range: The source data range to filter.
- condition1: The first condition to apply for filtering.
- condition2: (Optional) Additional conditions to refine the filter further.
Example #1
FILTER(A2:B10, B2:B10 > 50)
This function retrieves rows from the range A2:B10 where the values in column B are greater than 50. Example result:
| A | B |
|—-|—-|
| X | 60 |
| Y | 75 |
Example #2
FILTER(A2:C10, A2:A10 = 'Product A')
This call returns all rows from the range A2:C10 where column A equals ‘Product A’. Example result:
| A | B | C |
|———–|—–|—|
| Product A | 10 | 5 |
| Product A | 20 | 3 |
Example #3
FILTER(A2:D10, B2:B10 = 'Active', C2:C10 > 100)
This function filters rows from A2:D10, showing only those where column B is ‘Active’ and column C is greater than 100. Example result:
| A | B | C | D |
|—–|——–|—-|—|
| 1 | Active | 150| 3 |
| 2 | Active | 200| 2 |
Error handling
- REF! – This error occurs if the range is not valid or contains conflicting parameters.
- VALUE! – This indicates an invalid condition or if a cell in the condition range is empty.
- N/A – This means no rows match the given conditions.