# How do I use SUMIF to total expenses by category?

Use SUMIF with the category column as the range, the category name as the criterion and the amount column as the sum range, for example =SUMIF(C2:C500,"Supplies",D2:D500) in Google Sheets or Excel. It adds every amount in rows 2 to 500 whose category is Supplies. ProfitDrawer's bookkeeping spreadsheets total each category with SUMIFS, the multi-condition version, so one formula can also limit totals to a month.

**Syntax:** `SUMIF(range, criterion, [sum_range])`

- **range:** the cells tested, here the category column.
- **criterion:** the condition. Text goes in quotation marks, for example `"Supplies"`, and can use wildcards. Numbers can use `=`, `>` and `<`, for example `">20"`.
- **sum_range:** the cells to add, here the amounts. Leave it out only if you are adding the same cells you test.

**Example layout** (Expenses sheet): A = date, B = paid to, C = category, D = amount.

| Category | Total formula |
|---|---|
| Supplies | `=SUMIF($C$2:$C$500,"Supplies",$D$2:$D$500)` |
| Fuel | `=SUMIF($C$2:$C$500,"Fuel",$D$2:$D$500)` |

The dollar signs keep the ranges fixed if you copy the formula to another cell.

**Totals by category and month:** use SUMIFS, written `SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])`, so you can add a second test such as a date limit. Keep category spelling identical in every row (a dropdown helps), since "Supply" and "Supplies" are counted separately.

- Source: [Google Docs Editors Help: SUMIF function](https://support.google.com/docs/answer/3093583)
- Updated: 2026-10-29
- Published: 2026-10-29
- Category: Google Sheets and Excel how-tos
- Canonical: https://profitdrawer.com/answers/how-do-i-use-sumif-to-total-expenses-by-category.html
- Publisher: ProfitDrawer (https://profitdrawer.com)
