Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed:
Heads up: Excel and Google Sheets do this differently.
=SUMIFS(C2:C10,B2:B10,"Paid",D2:D10,E2)=QUERY(A1:D10,"SELECT D, SUM(C) WHERE B = 'Paid' GROUP BY D LABEL SUM(C) 'Paid Revenue'",1)Edit the grid or formula, then run it through a real spreadsheet engine — no signup.
Sample data — click any cell to edit
Need it for your exact data?
Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.
Not directly — QUERY does not support a HAVING clause. The workaround is to wrap the QUERY in another QUERY: =QUERY(QUERY(A1:D10,"SELECT D, SUM(C) WHERE B = 'Paid' GROUP BY D",1),"SELECT * WHERE Col2 > 1000",1) where the outer QUERY filters on the aggregated column.
Use COUNT on a column you know has unique values per row (like an order ID column A): SELECT D, COUNT(A) WHERE B = 'Paid' GROUP BY D. This gives the number of paid orders per region.
For a single criterion SUMIFS is faster to calculate. QUERY with GROUP BY becomes more practical when you need multiple aggregations or dynamic output — it spills a full summary table instead of requiring one SUMIFS formula per cell.
Use Google Sheets QUERY with a WHERE clause to filter rows dynamically — Excel users can use FILTER as the equivalent.
Error fixQUERY parse error in Google Sheets means the SQL-like query string has a syntax mistake. Find the exact error and fix it here.
How-toUse Google Sheets QUERY with GROUP BY and SUM to aggregate data by category — use SUMIF for the Excel equivalent.
How-toUse QUERY GROUP BY with multiple columns in Google Sheets to create multi-level summaries. Excel alternative uses SUMIFS with multiple criteria ranges.
How-toFilter QUERY results in Google Sheets using WHERE with AND and OR conditions. Excel users can replicate this with FILTER using * for AND and + for OR.
How-toBuild a running total in Google Sheets by combining QUERY for ordering with ARRAYFORMULA and SUMIF. Excel alternative uses a simple SUMIF with a locked anchor row.
Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed: