SUMIFS and COUNTIFS on large data
SUMIFS adds up the values that meet one or more conditions: revenue in Paris in 2026, orders above €100 from new customers. COUNTIFS counts the rows that meet them. They are the workhorses of Excel reporting, and they are also what makes a big workbook slow to recalculate. Here is how they work, the criteria syntax that trips people up, and how to get the same answers on millions of rows.
The syntax, once and for all
SUMIF has one condition: the range to test, the criterion, then the range to add. SUMIFS takes any number of conditions, and puts the range to add first. That order difference is the most common source of errors.
=SUMIF(B:B, "Paris", D:D)
=SUMIFS(D:D, B:B, "Paris", C:C, 2026)
=COUNTIFS(B:B, "Paris", D:D, ">100")Writing criteria
| Criterion | Matches |
|---|---|
| "Paris" | Exactly Paris, ignoring capitals |
| ">100" | Numbers above 100 |
| "<>Paris" | Everything except Paris |
| "Par*" | Text starting with Par (* is any text, ? one character) |
| "" | Empty cells |
| ">="&F1 | Above the value in F1 (Excel only: built from a cell) |
Criteria on text ignore capitals. A criterion is always a text that combines an operator and a value, which is why “>100” is written in quotes.
Classic mistakes
- Ranges of different sizes, such as B2:B1000 and D2:D999. Excel returns #VALUE! or a wrong sum. Use whole columns or a table.
- Numbers stored as text in the range to add. They are skipped silently, and the total is too low.
- Dates compared to text. ">01/01/2026" depends on the regional settings; build the date with DATE(2026,1,1) instead.
- Trailing spaces in the criteria column: “Paris ” is not “Paris”. Clean with TRIM first.
Why a big report with SUMIFS gets slow
A summary table of 50 products by 12 months is 600 SUMIFS cells, and each one scans the whole data range. On a few hundred thousand rows, every change triggers hundreds of millions of comparisons. That is the moment a pivot table, or a different tool, becomes the better answer.
The same functions in Big Sheets
Big Sheets is a spreadsheet for files of several million rows, in your browser. It has SUMIF, SUMIFS, COUNTIF, COUNTIFS, AVERAGEIFS, MAXIFS and MINIFS with their Excel names, in English or French, and the same criteria syntax: operators, wildcards, "" for blanks, capitals ignored. Columns are referred to by name:
=COUNTIF([City], "Paris")
=SUMIF([City], "Paris", [Revenue])
=SUMIFS([Revenue], [City], "Paris", [Year], 2026)In a data sheet, such a formula gives one total for the whole column, the same on every row, and the criterion is written in the formula. It is handy for a share: =[@Revenue]/SUMIF([City],"Paris",[Revenue]).
Totals per group: use a pivot table or Summarize
The usual reason to write hundreds of SUMIFS is to get a total per product, per month or per region. In Big Sheets, a pivot table does it in one go on every row: product in Rows, month in Columns, revenue in Values. Summarize does the same into a new flat sheet, with several totals per group. Neither needs a formula per cell, and both stay fast on millions of rows.
For a report laid out freely, a summary sheet accepts ordinary cell formulas, including SUMIF over a data sheet’s columns, so a small summary table can still be written the Excel way.
=SUMIF(Orders![Product], A2, Orders![Total])A worked example
An export of 2 million order lines, with a city, a year, a channel and an amount. The finance team asks three questions: revenue in Paris in 2026, the number of online orders above €100, and the share of Paris in the total.
The first two are single figures with fixed conditions: one SUMIFS and one COUNTIFS. The third is a calculated column that divides each row by a SUMIF, or simply a pivot table with % of grand total. Answering “revenue per city per year”, on the other hand, is a pivot table: city in Rows, year in Columns, amount in Values, done in one step on all 2 million rows.
Which one to choose
- One or two figures with fixed conditions: SUMIFS or COUNTIFS.
- A total for every value of a column: a pivot table.
- A table of totals you will keep working on: Summarize.
- A presentation layout with a few figures: a summary sheet with SUMIF.
All of them run on the full file in your browser, and your data never leaves your device. Try them on the sample data, no account needed.
Try it on your own file
Open it in Big Sheets: no sign-up, and your file never leaves this browser.
One plan: €29 incl. VAT per month, everything included, cancel any time. See pricing
Questions
- Do SUMIFS criteria ignore capitals?
- Yes, in Excel and in Big Sheets: "paris" matches "Paris".
- Can the criterion be another column?
- Not in a data sheet’s formula in Big Sheets: the criterion is written in the formula. For a total per value of a column, use a pivot table or Summarize.
- Does SUMIFS work on more than a million rows?
- In Big Sheets, yes: formulas run on the whole column, on files tested up to 5 million rows.