ConvertCalculator Icon

FILTER function

The FILTER function allows you to perform an action (function) over each element of an array deciding whether it should stay in the array or not. Resulting in a new filtered array.


The syntax for FILTER is as follows

FILTER(array, f)
  • array an array (collection/list) of values
  • f the function you want to apply to each value (can be built-in or a custom function)

The result is another array


// only keep values that are numbers FILTER(ARRAY(1, 2, -5, 'string', ARRAY(), true), ISNUMBER) // -> [1, 2, -5] // only keep value that are positive (greater or equal to 0) FILTER(ARRAY(-5, -3, 3, 5, 100, -100, 0), function(x: x >= 0)) // -> [3, 5, 100, 0]

Related articles

Learn more about filter in one of the following articles