Build a budget with SUMIF and SUMIFS
Keep one list of purchases and let Excel sort them into categories and months. Two functions, SUMIF and SUMIFS, turn a flat list into a budget that updates the moment you change a number or a month.
- Level
- Beginner
- Reading time
- About 12 minutes
- Know this first
- Core functions and percentages
By the end you will be able to:
- lay out a list of transactions so that formulas can read it
- total a category with SUMIF
- total a category in a month with SUMIFS and lock its ranges
- build a budget table with amount left and share used
- switch the whole table to another month by changing one cell
A budget that does its own adding
A paper budget has a list of what you planned and a list of what you spent, and you add up the second list by hand. A spreadsheet can keep one running list of every purchase and sort it into categories by itself. The tool is SUMIF, and its more capable partner SUMIFS, which adds only the amounts that meet a condition.
The idea is the same as the plan and the comparison in the lesson on budgeting, needs and wants, with the arithmetic handed to Excel. The example uses an invented household and two months of purchases.
Keep the data in one list
The foundation is a plain list, one row per purchase, with one fact per column: the month, the category, a note and the amount. Do not put totals in the list and do not leave blank rows. A list like this is easy to add to, and every formula can read it.
Use the same spelling for each category every time. To Excel, “Groceries” and “Grocery” are two different categories, and the second would silently fall out of the totals.
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Month | Category | Description | Amount |
| 2 | Jan | Rent | Monthly rent | $1,200 |
| 3 | Jan | Groceries | Supermarket | $118 |
| 4 | Jan | Eating out | Lunch with friends | $38 |
| 5 | Jan | Transport | Bus pass | $45 |
| 6 | Jan | Groceries | Market | $96 |
| 7 | Jan | Utilities | Electricity | $82 |
| 8 | Jan | Eating out | Takeaway | $55 |
| 9 | Jan | Groceries | Supermarket | $132 |
| 10 | Jan | Transport | Fuel | $60 |
SUMIF: add if one condition is met
SUMIF(range, criteria, sum_range) looks down the range, finds the cells that match the criteria, and adds the matching cells of the sum_range. To add everything bought in the Groceries category over both months, the formula is =SUMIF(Transactions!$B$2:$B$19, $A5, Transactions!$D$2:$D$19).
The first range is the category column, the criteria is the word in cell A5, and the amounts to add come from column D. In the sheet this is the last column, “Both months”, and for groceries it gives $667. The dollar signs lock the ranges so that the formula can be copied down to every category.
SUMIFS: add if several conditions are met
The budget needs more than one condition: the right category and the right month. SUMIFS takes the range to add first, and then pairs of a range and a criteria: SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2, criteria2). An amount is added only when every condition is true. Note that the order differs from SUMIF, where the range to add comes last.
Cell B1 holds the month, so changing it changes the whole table. In the February sheet, groceries were $321 against a budget of 400, which is 80% used and $79 left. Eating out was $177 against 150, which is 118% used, so the household was $27 over.
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Month shown | Feb | ||||
| 2 | ||||||
| 3 | Category | Budget | Actual | Left | Used | Both months |
| 4 | Rent | $1,200 | $1,200 | $0 | 100% | $2,400 |
| 5 | Groceries | $400 | $321 | $79 | 80% | $667 |
| 6 | Transport | $100 | $52 | $48 | 52% | $157 |
| 7 | Utilities | $90 | $88 | $2 | 98% | $170 |
| 8 | Eating out | $150 | $177 | −$27 | 118% | $270 |
| 9 | Total | $1,940 | $1,838 | $102 | 95% | $3,664 |
The whole month came to $1,838 against a total budget of $1,940, so $102 was left. A month with one category over and another under is exactly what a budget is meant to show.
Change one cell, change the month
Now type Jan in B1. Nothing else is touched. The same formulas read the same list with a different condition, and the table shows January: total spending of $1,826 and eating out of only $93. Once a model is built this way, adding March means typing new rows at the bottom and extending the ranges, with no new formulas.
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Month shown | Jan | ||||
| 2 | ||||||
| 3 | Category | Budget | Actual | Left | Used | Both months |
| 4 | Rent | $1,200 | $1,200 | $0 | 100% | $2,400 |
| 5 | Groceries | $400 | $346 | $54 | 87% | $667 |
| 6 | Transport | $100 | $105 | −$5 | 105% | $157 |
| 7 | Utilities | $90 | $82 | $8 | 91% | $170 |
| 8 | Eating out | $150 | $93 | $57 | 62% | $270 |
| 9 | Total | $1,940 | $1,826 | $114 | 94% | $3,664 |
Try it yourself
The practice workbook holds the two sheets drawn above, plus a small March list and a sheet with three cells to fill in. Try writing the SUMIFS yourself before looking at the answers.
Download the practice workbook (free .xlsx, no sign-up).
What this lesson leaves out
- An invented household. The amounts, categories and budgets are made up to show the mechanics. They are not a recommendation for any real household.
- Two months only. A year of transactions would be a longer list, but the formulas are the same. Extending the ranges is the only change.
- No dates. The months are typed as words so that the lesson does not need date rules. Real bank exports carry dates, which can be turned into months with other functions.
- No pivot tables. A pivot table builds a summary like this by dragging fields. SUMIFS is shown first because it makes you say exactly what is being added.
Common mistakes
Category names that do not match
A space at the end of a word, or a different spelling, means a purchase is not counted. Pick names from a list rather than typing them freely.
Ranges that are not the same size
The sum range and each criteria range in SUMIFS must have the same number of rows, or the formula returns an error.
Forgetting the dollar signs
The three ranges must stay put as the formula is copied down, so lock them. Only the category cell, $A4, should follow the row.
Ranges that stop short
If new rows are added below the range, they are not counted. Check that the ranges reach the last row.
Typing totals into the list
A total row inside the data is added into other totals. Keep the list clean and put totals on another sheet.
Questions to answer
1. The February sheet shows groceries of 321 against a budget of 400. What are the amount left and the share used?
Show the working
400 − 321 = $79 left, and 321 ÷ 400 = 80% used.
2. Which function adds the amounts for one category over both months, and which adds the amounts for one category in one month?
Show the working
SUMIF takes one condition, so it handles one category over both months. SUMIFS takes more than one, so it handles one category in one month.
3. Why does the formula use $B$2:$B$19 and not B2:B19?
Show the working
The dollar signs lock the range. When the formula is copied down to the next category, the range must stay on the same 18 rows, while only the category cell, $A4, moves.
4. Eating out in January was 93 and in February was 177. By what percentage did it rise?
Show the working
177 ÷ 93 − 1 = 90.3%.
5. In the practice workbook, what is groceries spending in March, and what is the total of all March spending?
Show the working
Groceries in March are 110 + 96 = $206. All March spending is $1,544, which includes 1,200 of rent, 91 of eating out and 47 of transport.
Where this is used
- A household sorts a bank statement into categories to see where the money goes.
- A small business totals expenses by type and by month for its accountant.
- A manager compares each department's actual spending with its budget, line by line.
- An analyst adds up sales by region and by product from one long export of orders.
- A club treasurer tracks income and costs by event from a single list.
Key terms
- SUMIF
- Adds the cells that meet one condition.
- SUMIFS
- Adds the cells that meet several conditions at once.
- Criteria
- The rule a cell must meet to be included, such as a category name.
- Sum range
- The cells whose values are added.
- Variance
- The difference between the budget and what was actually spent.
- Used
- Actual spending as a share of the budget.
- Data list
- A table with one row per record and one fact per column.
Questions people ask
Do SUMIF and SUMIFS care about upper and lower case?
No. “groceries” and “Groceries” match. They do care about spelling and extra spaces.
Can the criteria be something other than a word?
Yes. A criteria such as “>100” adds only amounts above 100, and a cell reference can supply the criteria, which is what the month in B1 does.
Should I use a pivot table instead?
A pivot table is faster for exploring a big list. SUMIFS gives a table that you lay out yourself and that updates the moment the list changes. Both are worth learning.
Why not type the total for each category by hand?
A typed total will not change when a purchase is corrected or added. A formula always agrees with the list.
Sources and review
- Microsoft Support, SUMIFS function, for the order of the arguments and how several conditions combine.
- Microsoft Support, Switch between relative, absolute, and mixed references, for how a reference changes when a formula is copied and the keys that add the dollar signs.
How the numbers were checked: every sheet drawn in this lesson was built as a real workbook, recalculated with LibreOffice, and drawn from the recalculated cells, so the figures are what a spreadsheet really computes. The worked answers were recomputed the same way. These are standard functions with the same definitions in Excel and Google Sheets. The practice file is the same workbook.