SUMIFS in Google Sheets: Category Totals That Update When Expenses Change
Group expenses into category totals that update when values change.
Download practice data · CSVStart the exerciseWatch the tutorial
Try it yourself
- Import the CSV at A1. Columns A/B contain expenses; column D already contains summary categories.
- Enter the formula below in E2 and copy down to E4. Format B and E as currency.
- Expect Food 42, Transport 18 and Tools 35. Change B2 from 12 to 22: Food becomes 52; the other totals stay the same.
=SUMIFS($B$2:$B$8,$A$2:$A$8,D2)Amounts must be numbers; category spaces affect matching; extend both source ranges beyond row8. SUMIF is also enough for one condition.
A summary should follow the source, not replace it
The formula sums amounts only where a category matches the label in the summary row. Locked source ranges keep the input fixed when the formula is filled down; the criterion cell changes from D2 to D3 and D4. SUMIF is sufficient for one condition, while SUMIFS is useful when you later add a second condition such as a project or date range.
When the result looks wrong
A category with an extra space can create a separate group. A number stored as text may fail to contribute as expected. Keep category and amount ranges the same height. The summary reads the rows in its range; adding expenses below that range requires extending it.
A check you can repeat
Food changes when the first expense changes, but Transport and Tools must not. The three displayed category totals should add to the sum of all seven numeric expense inputs. This cross-check catches an omitted category.
Preview the input data
practice.csv
| Category | Amount (USD) | Category | Total (USD) | |
|---|---|---|---|---|
| Food | 12 | Food | ||
| Transport | 8 | Transport | ||
| Food | 18 | Tools | ||
| Tools | 20 | |||
| Food | 12 | |||
| Transport | 10 | |||
| Tools | 15 |
Need help importing, choosing separators or setting the locale? How to use the practice files.