🟩 Sheet Formulas
FILTER vs QUERY

FILTER vs QUERY in Google Sheets

Short answer: Use FILTER when you just want the rows that match a few conditions. Reach for QUERY when you also need to sort, group, aggregate (SUM/COUNT), pick specific columns or format output β€” it's a mini SQL language.

Copy the one most people want (QUERY)

=QUERY(A1:D, "select A, sum(D) where B = 'East' group by A order by sum(D) desc", 1)

Filters to East, groups by column A and totals column D, sorted high-to-low β€” something FILTER alone can't do.

FILTER vs QUERY β€” the differences that matter

AspectFILTERQUERY
Best atReturning matching rows quickly.Filtering + sorting + grouping + aggregating in one formula.
SyntaxPlain conditions: FILTER(range, cond1, cond2).A SQL-like string you write inside quotes.
Aggregation (SUM/COUNT/AVG)Not built in β€” combine with other functions.Built in via group by.
Column selection / orderReturns the range as-is.select A, C picks and reorders columns.
Learning curveEasy β€” reads like normal conditions.Steeper β€” you learn the QUERY language, but it's powerful.

Which one should you use?

Use FILTER when…

You want the rows where status is Open, or amount > 100 β€” a straightforward subset with no grouping or reshaping.

Use QUERY when…

You need totals per category, sorted results, only certain columns, date formatting, or a pivot-style summary β€” all in a single formula.

Same task, both formulas

Show only rows where column B equals "East".

FILTER
=FILTER(A2:D, B2:B="East")
QUERY
=QUERY(A1:D, "select * where B = 'East'", 1)

For plain filtering they're equivalent; QUERY's payoff appears the moment you add group by, order by or aggregates.

FAQ

Is QUERY faster than FILTER?

For simple filtering they're comparable. QUERY does more work when you group or sort, but it replaces several formulas with one.

Can FILTER sort results?

Not by itself β€” wrap it in SORT: =SORT(FILTER(...), 1, TRUE). QUERY sorts inline with order by.

Which is better for a dashboard summary?

QUERY β€” group by and aggregates let one formula produce a category-by-category summary.