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(D2:D10,B2:B10,F2,C2:C10,G2)=QUERY(A1:D10,"SELECT B, C, SUM(D) WHERE A IS NOT NULL GROUP BY B, C ORDER BY B, C LABEL SUM(D) '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.
Practically no hard limit, but each additional GROUP BY column multiplies the number of output rows. Beyond three or four grouping columns the result usually becomes harder to read than a proper pivot table.
QUERY does not support arbitrary expressions in GROUP BY directly. You can pre-compute a helper column in your sheet, or use the scalar functions QUERY provides (year(), month(), day(), hour()).
Use SUMIFS with multiple criteria ranges: =SUMIFS(D:D, B:B, region_cell, C:C, product_cell). To generate the unique group list automatically, use the UNIQUE function (Excel 365) or a helper column.
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-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.
How-toCombine QUERY and IMPORTRANGE in Google Sheets to filter and aggregate data from another spreadsheet file. There is no Excel equivalent — use Power Query to connect workbooks instead.
Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed: