To add up the amounts where another column contains a word, use SUMIF with asterisks around the word: =SUMIF(A2:A100, "*fuel*", B2:B100). The first range is where to look, the criteria is the word with * on both sides, and the last range holds the amounts.
{"cells": {"A1": "Question", "A10": "Fuel - OMV", "A11": "Rent", "A12": "fuel card fee", "A13": "Parking", "A2": "Spent on fuel", "A3": "Fuel in November", "A4": "Everything but fuel", "A7": "Description", "A8": "Fuel - Shell", "A9": "Groceries", "B1": "Answer", "B10": 92, "B11": 650, "B12": 12, "B13": 30, "B2": "=SUMIF(A8:A13,\"*fuel*\",B8:B13)", "B3": "=SUMIFS(B8:B13,A8:A13,\"*fuel*\",C8:C13,\"Nov\")", "B4": "=SUMIF(A8:A13,\"\u003c\u003e*fuel*\",B8:B13)", "B7": "Amount", "B8": 85, "B9": 120, "C10": "Dec", "C11": "Nov", "C12": "Dec", "C13": "Nov", "C7": "Month", "C8": "Nov", "C9": "Nov"}, "focus": "B2", "note": "Change an amount in column B and watch the totals."}
One condition: SUMIF
The order is range to check, criteria, range to add.
=SUMIF(A2:A100, "*fuel*", B2:B100)All fuel spending.=SUMIF(A2:A100, "*"&E1&"*", B2:B100)Whatever word is typed in E1.Two conditions: SUMIFS
In SUMIFS the range to add comes first, then pairs of range and criteria.
=SUMIFS(B2:B100, A2:A100, "*fuel*", C2:C100, "Nov")Fuel in November only.Everything except
<> means "not equal", and it works with wildcards too.
=SUMIF(A2:A100, "<>*fuel*", B2:B100)All amounts whose description doesn't mention fuel.Common mistakes
- SUMIF returns 0
- The word has no asterisks around it, or the amounts are stored as text.
- Wrong totals in SUMIFS
- The ranges have different sizes, like
B2:B100andA2:A99. Make them start and end on the same rows.
Frequently asked questions
Can SUMIF check part of a cell?
Yes, with wildcards: *word* for anywhere in the cell, word* for the start, *word for the end.
Is SUMIF case-sensitive?
No. fuel, Fuel and FUEL are the same to SUMIF.
How do I count those cells instead?
Use COUNTIF with the same criteria. See count cells that contain text.