FILTER

Filter JSON data or ranges by a given condition.

Parameter List

Syntax
FILTER(datacondition
[if_empty]
[mode]
)
data

The range or data that you want to filter by some criteria. For example: A1:B4 or '[["name","age"],["John",30],["Ann",28]]'.

condition

Expression that contains a range/ JSON with the same size as data. Examples: A1:A5>5, A1:A5=B1:B5 or A1:A2='"London","Paris"'. You can combine conditions with "*" (AND) and "+" (OR). Example:(A1:A5>5)*(A1:A5<10)`.

[optional] if_empty

The output of the function when there is no results found.

[optional] mode

By default (0) FILTER keeps the first row/ column (header). Use 1 to keep it only if it matches conditions. 2 always removes it.

Examples

FILTER(A1:B3, A1:A3="John", "No results", 1) returns [["John",20]]