Convert an Excel SUMIFS Formula to SQL GROUP BY
How an Excel SUMIFS formula becomes a SQL query with WHERE and GROUP BY, which databases the converter supports, the syntax check and the functions with no exact SQL equivalent.

When a report moves from a spreadsheet to a database, each SUMIFS column becomes a SELECT with a WHERE clause and a GROUP BY. To turn one into SQL, paste it into the Formula to SQL & pandas Converter, describe the table and pick the target. The tool writes the query, checks its syntax and lists what it could not translate exactly.
How SUMIFS maps to WHERE and GROUP BY
Take this formula, filled down a list of regions in column A:
=SUMIFS(Sales!$C:$C,Sales!$A:$A,$A2,Sales!$B:$B,">="&DATE(2026,1,1))
It adds the amounts in column C of the Sales sheet where the region in column A equals the region in the row, and the date in column B is on or after 1 January 2026. As a SQL query, the result is:
SELECT region, SUM(amount) AS total_amount
FROM sales
WHERE order_date >= DATE '2026-01-01'
GROUP BY region
ORDER BY region;
The mapping follows a pattern:
- The sum range, column C, becomes SUM(amount).
- A date condition on a column becomes a condition in WHERE.
- A criterion that compares a column with each value in a list of regions, as the $A2 reference does, becomes GROUP BY region. The query returns one row per region, instead of one formula per row.

The PostgreSQL documentation describes the clauses in its sections on aggregate functions and on GROUP BY.
Steps: formula, table description, target, Convert
- Open the Formula to SQL & pandas Converter.
- Paste the formula into Formula or description, and add a note on how it is used, for example "filled down next to a list of regions in A2:A10".
- In Table and columns, describe the database table with its types: sales(region text, order_date date, amount numeric).
- Under Convert to, pick PostgreSQL, MySQL, SQLite, SQL Server (T-SQL) or Python pandas.
- Press Convert.
The table description is what gives the query your real column names, such as amount for Sales!$C:$C. It is optional, but without it the tool has to invent names. Pressing Convert sends the formula and the description to our server and to the AI provider, and the tool allows 10 AI requests per 10 minutes.
The same formula for a single month is explained in SUMIFS Between Two Dates: Sum One Month in Excel. The date bounds there, one with >= and one with <, carry over to SQL unchanged.
Read the syntax check and the mapping table
Under the query, the tool shows the result of a syntax check. The SQL is parsed with the parser of the dialect you picked, so a query for PostgreSQL is checked with PostgreSQL rules. The code is never run. A few constructs, such as PIVOT, MERGE or QUALIFY, cannot be parsed by the checker, and the tool then says that the query was not checked. When the check passes, it tells you that the statement is well-formed. It does not tell you whether the table and columns exist in your database or whether the totals match your sheet.

The mapping table lists each part of the formula and the SQL that replaces it. Read it line by line against the formula. If a column is mapped to the wrong name, correct the table description and convert again.
Then run the query yourself on a copy of the data and compare the totals with the sheet for two or three regions. To load a spreadsheet export into a test table first, use the CSV to SQL INSERT Generator. It writes INSERT statements for MySQL, PostgreSQL, SQLite and SQL Server.
Features with no exact equivalent
Some spreadsheet features do not translate one to one. The converter flags these:
- Approximate VLOOKUP. A lookup with TRUE or no fourth argument depends on the sort order of the table. In SQL it needs a range condition, so check the result.
- Volatile functions such as TODAY, NOW, RAND, OFFSET and INDIRECT. They change with each recalculation, or read cells by address. A query is not recalculated that way.
- Array formulas. Their cell-by-cell logic has no direct counterpart in a query.

For a formula with TODAY(), the warning tells you that the result depends on the date at which the query runs. Decide whether you want that date to be fixed in the query or passed in as a parameter.
If you work in Python instead of SQL, the same converter writes pandas code, and the lookup case is in Do a VLOOKUP in pandas With a Left Merge.
Do it with your own data
Open the Formula to SQL & pandas Converter, paste a SUMIFS, describe the table and pick your database. Read the syntax check and the mapping table, then run the query on a copy of the data and compare a few totals with the sheet.