Workflow guide
Google Sheets QUERY vs FILTER
Use FILTER when you want matching rows in the same column layout with the shortest possible formula. Use QUERY when you need selected columns, sorting, grouping, labels, or SQL-like report output. This guide shows the exact difference with copyable formulas, date examples, and a simple decision matrix.
QUERY vs FILTER decision table
| Situation | Use | Why |
|---|---|---|
| Return rows that match one or two simple conditions | FILTER | FILTER is shorter and easier to read when you want the same columns in the same order. |
| Select only some columns or reorder columns | QUERY | QUERY can use SELECT A, B, D and return a report-shaped output directly. |
| Filter by a Google Sheets date range | QUERY or FILTER | FILTER is simpler with date cells; QUERY is better when the result also needs selected columns or sorting. |
| Need ORDER BY or SQL-like report logic | QUERY | QUERY supports clauses such as SELECT, WHERE, ORDER BY, and headers in one formula. |
Sample data
| Date | Region | Product | Amount |
|---|---|---|---|
| 2026-01-04 | East | Widget | 420 |
| 2026-01-12 | West | Widget | 310 |
| 2026-02-03 | East | Gadget | 275 |
| 2026-02-15 | East | Widget | 640 |
Side-by-side examples
=QUERY(A1:D100,"select A, B, D where B = 'East' order by A",1) Use QUERY when you want selected columns and sorted report output.
=IFERROR(FILTER(A2:D100,B2:B100="East"),"No matches") Use FILTER when you want the original rows and columns that match the condition.
=QUERY(A1:D100,"select A, B, D where A >= date '"&TEXT(F1,"yyyy-mm-dd")&"' and A < date '"&TEXT(G1,"yyyy-mm-dd")&"'",1) Use TEXT to convert spreadsheet date cells into QUERY date literals.
=SORT(FILTER(A2:D100,B2:B100="East"),1,TRUE) Use SORT around FILTER when the output should keep all source columns but sort returned rows.
Choosing between QUERY and FILTER
Use FILTER for simple matching rows. Use QUERY when the output needs selected columns, sorting, grouping, labels, or SQL-like clauses.
Same rows, same columns
FILTER is usually clearer when the result should return the same columns in the same order as the source table.
=IFERROR(FILTER(A2:D100,B2:B100="East"),"No matches") Select only some columns
QUERY is better when the result should return only selected columns or reorder columns.
=QUERY(A1:D100,"select A, B, D where B = 'East' order by A",1) Date range filtering
QUERY date ranges need date literals or TEXT(date_cell,"yyyy-mm-dd") when dates come from cells.
=QUERY(A1:D100,"select A, B, D where A >= date '"&TEXT(F1,"yyyy-mm-dd")&"' and A < date '"&TEXT(G1,"yyyy-mm-dd")&"'",1) Sorted report output
QUERY can sort inside the query string. FILTER can be wrapped in SORT when you want the full source layout sorted.
=SORT(FILTER(A2:D100,B2:B100="East"),1,TRUE) When QUERY wins
QUERY wins when you need SELECT, WHERE, ORDER BY, GROUP BY, LABEL, FORMAT, or Col1 notation for imported arrays.
When FILTER wins
FILTER wins when the logic is simple, the result should keep the same columns, and teammates need the shortest readable formula.
When not to use either
Use SUMIFS, COUNTIFS, Pivot Tables, or charts when you need totals, counts, or summarized reporting instead of returned rows.
Excel vs Google Sheets differences
Google Sheets supports QUERY. Excel does not. Excel has FILTER, but its dynamic array behavior and available functions depend on version.
Common errors
QUERY date filters fail when display dates are pasted into the query string instead of date literals.
FILTER fails when the returned range and condition range heights do not match.
FILTER spill output fails when existing cells block the result area.
Returned output from the sample data
| Task | QUERY output | FILTER output |
|---|---|---|
| East rows | Returns Date, Region, and Amount for three East rows. | Returns all columns for the same three East rows. |
| January date range | Can return selected columns such as Date, Region, and Amount for the two January rows. | Returns the original source columns for the same two January rows. |
| Sorted East report | ORDER BY A sorts inside the query string. | Use SORT(FILTER(...),1,TRUE) when the filtered rows need ordering. |
| Grouped total by region | QUERY can return East = 1335 and West = 310 with GROUP BY. | FILTER should not be used for grouped totals; use QUERY or SUMIFS instead. |
How the workflow fits together
- FILTER is usually the fastest choice when the output should keep the source columns unchanged.
- QUERY is stronger when you want a report: selected columns, ordered rows, date literals, and a header-row argument.
- Both formulas run inside Google Sheets. Neither requires uploading a spreadsheet to this site.
- After choosing the pattern, use the matching builder to create your own version with your real ranges and criteria.
Common mistakes
- Do not use QUERY date filters with display dates such as 1/1/2026. Use date 'YYYY-MM-DD' or TEXT(date_cell,"yyyy-mm-dd").
- Do not copy the Google Sheets FILTER syntax into Excel without checking the Excel output; Excel combines conditions differently.
- Do not use QUERY when a simple FILTER formula is easier for teammates to audit.
- Do not use FILTER when you need SELECT, ORDER BY, or report-shaped output.
Related formulas
FAQ
Is QUERY better than FILTER in Google Sheets?
QUERY is better for report-shaped output with selected columns, sorting, and date literals. FILTER is better for simpler row filtering.
Can FILTER sort or reorder columns?
FILTER can be wrapped in SORT for row ordering, but it does not select or reorder columns as directly as QUERY SELECT.
Which formula is easier for dashboards?
FILTER is easier for simple live row views. QUERY is better for dashboard tables that need selected columns, sorting, labels, or grouped totals.
Do these formulas work in Excel?
FILTER has an Excel dynamic array version. QUERY is a Google Sheets function and does not work in Excel.
Can I copy these examples into my own sheet?
Yes. Start with the sample formulas, then replace the source ranges, date cells, selected columns, and criteria with your own sheet references.