FILTER
Returns a subset of an array by keeping only the elements that match a given condition. FILTER is one of the most powerful tools in FormulaScript — used to clean datasets, extract matching values, or prepare smaller result sets for further analysis.
Syntax
FILTER(array, condition)array (Array): The source array to filter.
condition (Boolean | Function | Array):
A function: evaluated for each element (
function(item) -> boolean).A boolean expression: tested directly against each element.
An array: treated as a list of allowed values.
Returns: Array – A new array containing only the elements that satisfy the condition.
Aliases: WHERE, SELECT, FILTERARRAY
Examples
Simple Example
FILTER(ARRAY(1,2,3,4,5), function(x: x > 3)) // [4, 5]
FILTER(ARRAY("A","B","C"), ARRAY("B","C")) // ["B","C"]
FILTER(ARRAY(true,false,true), true) // [true, true]Business Example: Filter High-Value Orders
Filter order totals over $500 for a sales report:
FILTER(ORDER_TOTALS, function(TOTAL: TOTAL > 500))Returns only high-value transactions for executive dashboards or commission calculations.
Business Example: Extract Active Projects
Keep only active projects visible on dashboards using allowed-value filtering:
FILTER(PROJECT_STATUS_LIST, ARRAY("Active", "In Progress"))Business Example: Filter Table Rows
Extract rows from a data table where the first column (total) exceeds 1000:
FILTER(SALES_TABLE, function(row: row[0] > 1000))Piping for Readability
Chain filters with other array functions using pipe syntax:
ORDER_TOTALS | FILTER(x: x > 500) | SUM
PRICES | MAP(p: p * 1.21) | FILTER(p: p < 100) | COUNTCommon Mistakes
When using a function, use
function(x: ...)syntax or shorthandx: ...in pipes.Returns an empty array (
[]) if no matches are found — notnull.For table data, access columns by index:
row[0],row[1], etc.Nested filtering is supported:
FILTER(FILTER(data, x: x > 10), x: x < 100)
For filtering tables with multiple column-specific criteria, use TABLEFILTER instead — it's optimized for multi-column AND conditions.
See Also
MAP · TABLEFILTER · ALL · ARRAY