Run a SQL-like query over a range to filter, sort, group, and aggregate in one formula.
This function works the same in Google Sheets as it does in Excel — same syntax and arguments.
QUERY(data, query, [headers])QUERY is the most powerful Google Sheets-only function. It uses the Google Visualization API query language (SELECT, WHERE, GROUP BY, ORDER BY) to transform a range without helper columns. There is no Excel equivalent.
=QUERY(A1:D, "SELECT A, SUM(D) WHERE C='Paid' GROUP BY A", 1)Result: Totals per group
Sums column D per value in A, only where C is 'Paid'.
No — QUERY is Google Sheets-only. The closest Excel options are FILTER, pivot tables, or Power Query.