← All comparisons

FILTER vs QUERY: Sheets' two ways to slice data

In Google Sheets these overlap heavily, so people ask which to learn. The portability answer is decisive: FILTER now exists in Excel and LibreOffice too (verified by execution), while QUERY is Google Sheets-only — a sheet built on QUERY cannot be exported anywhere.

The differences at a glance

FILTERQUERY
Keep rows matching conditionsYes — its whole jobYes (WHERE clause)
Select/reorder specific columnsNo — returns whole rows of the range (combine with CHOOSECOLS)Yes (SELECT B, D)
Sort, group, aggregate, pivotNo — compose with SORT/UNIQUE/etc.Yes — ORDER BY, GROUP BY, PIVOT, SUM()...
Syntax styleSpreadsheet formulasMini-SQL in a text string
Google SheetsYesYes
ExcelYes (365/2021)No — #NAME?
LibreOffice (executed result)Yes since 24.8 (quirks noted on its page)No — not implemented

Which should you use?

Compatibility (from executed tests)

We executed FILTER in real LibreOffice: #NAME? in 24.2, working (with edge-case quirks — see its function page) from 24.8. QUERY is documented only by Google; in Excel and LibreOffice it does not exist at all. Exporting a QUERY-based sheet to .xlsx silently breaks every QUERY cell.

Example formulas

FILTER (portable)=FILTER(A2:C10,C2:C10>100)
QUERY (Sheets only)=QUERY(A1:C10,"SELECT A, SUM(C) WHERE C > 100 GROUP BY A",1)

Full per-version details on each function page: FILTER · QUERY.