Excel SUMIF Formula: How to Sum by Condition
In this article
The SUMIF function adds up numbers in a range only when they meet a condition you set. Its syntax is =SUMIF(range, criteria, [sum_range]) — for example, =SUMIF(B2:B100, "North", C2:C100) totals every value in C where column B says "North". That is the whole trick: point it at the column you want to test, state the test, then point it at the numbers to add.
SUMIF works the same way in every modern version of Excel for Windows, Mac, the web, iPhone and Android, though a few small things — how you type a range, whether you see the formula preview — differ by version and device. It is not a macro or add-in, so you can use it in any workbook you can edit.
What You'll Need
- A workbook where the column you test and the numbers you add are laid out in clear, single-row-header columns (a table format helps but is not required).
- Consistent text in the test column — the same spelling and capitalisation pattern for each category you want to match.
- Numbers stored as actual numbers in the sum column, not as text. If a cell shows a green triangle in its corner, Excel may be treating it as text and it will be ignored.
- An empty cell to hold the result, ideally on the same sheet as the data or on a summary sheet you can reference.
Step-by-Step
- Set up your data so the test and the totals are in separate columns. SUMIF needs a range to check and a range to add. Decide now which column holds the label (for example Category or Region) and which holds the amount. Keeping headers in row 1 and data from row 2 down makes everything easier to read and stops you from accidentally counting the header word.
- Click the cell where the result should appear and type an equals sign. Excel will offer a function list; you can keep typing.
- Type
SUMIF(and Excel shows the argument hints under the formula bar. On most desktop versions you see the first argument (range) highlighted, then criteria, then sum_range. On mobile the hints are smaller or absent, so type carefully. - Select the range to test. Drag over the label column, for example
B2:B100. Press F4 (or Cmd+T on Mac) to lock it as$B$2:$B$100if you plan to copy the formula. Including a few extra blank rows is fine — blanks simply never match your criteria. - Type a comma, then the criteria in quotes. For text,
"North"matches the word North. For a number, no quotes are needed:50matches exactly 50. Operators go inside the quotes:">=100"sums values of 100 or more,"<>North"sums everything except North. - Type a comma, then select the range to add. This should have the same shape and row alignment as your test range — for example
C2:C100. If you leave this argument out, Excel adds the test range itself, which is only correct when the numbers live in the same column you are testing. - Close the bracket and press Enter. The cell shows the total. Click the cell and check the formula bar against your data: a result of zero often means the criteria text does not match, not that the formula is broken.
- Copy the formula down or across if you need several totals. Put a list of categories in a column (North, South, East, West) and change the criteria to a cell reference, for example
=SUMIF($B$2:$B$100, E2, $C$2:$C$100), where E2 holds the category. Use dollars on the ranges so they do not shift when you fill down. - Test one result by hand. Filter the label column to a single category, select the numbers in the sum column, and read the status bar total. If the manual total matches the formula, you have built it correctly.
Common Mistakes
- Mismatched range sizes. If the range is 99 rows and the sum_range is 100, Excel may stretch or truncate one to fit the other and quietly give a wrong total. Make both ranges the same height.
- Criteria typed without quotes.
=SUMIF(B2:B100, North, C2:C100)fails or resolves to the wrong thing because North is treated as a name. Text criteria need double quotes, or a cell reference to the text. - Numbers stored as text. Imported data often arrives with numbers left-aligned and a green warning triangle. SUMIF ignores those cells, so the total comes out short. Convert them with Text to Columns or by multiplying by 1, then check the status bar total again.
- Trailing spaces in labels. "North " and "North" look identical on screen but do not match. Use
"*North*"if you want partial matching, or clean the data with Find and Replace or the TRIM function. - Wildcards behaving oddly. An asterisk (
*) means any number of characters and a question mark (?) means exactly one, so a literal asterisk or question mark in your text needs a tilde in front (~*or~?). - Copying without locking ranges. Filling a formula down without dollar signs makes the test range slide, and results drift with each row.
Tips
- Use cell references for criteria rather than typed text, so you can change a category by editing one cell instead of the formula.
- The status bar total (bottom right) is the quickest sanity check — select your sum column after filtering and compare.
- For more than one condition, use SUMIFS with the same structure: sum range first, then pairs of criteria ranges and criteria.
- Date criteria work well:
">="&DATE(2026,1,1)sums everything from the start of the year, and it is clearer than typing a date string. - If your range changes size as data is added, convert the data to an Excel Table and reference the table columns; the ranges grow automatically.
- Keep a small test corner in your workbook with one known category and a hand-added total. When a formula looks wrong, you can see immediately whether it is the formula or the data.
Troubleshooting
Result is zero when you expect a total. Check the criteria text character by character, including spaces and capitalisation in languages where it matters. Try "*North*" to see if the label contains hidden extra characters. If that works, clean the data.
The total is lower than a manual count. Look for text-formatted numbers in the sum column. Select the column, check whether values line up left or right, and convert any text numbers to real numbers.
The formula returns a wrong number after filling down. You almost certainly forgot the dollar signs. Press Ctrl+Z, add $ before letters and row numbers in both ranges, and fill again.
Excel shows #VALUE! or will not accept the formula. Check that brackets and commas are correct for your locale — some regions use a semicolon as the argument separator, so write =SUMIF(B2:B100; "North"; C2:C100). Also confirm you have not accidentally typed a smart quote instead of a straight quote.
The formula disappeared and shows as text. The cell is formatted as Text. Change it to General, then retype the formula and press Enter.
Still wrong? Build the formula in a brand-new cell with a tiny range — one row — and confirm that single row behaves as expected. Rebuilding on a small range shows you exactly which argument is off without hunting through long ranges.
Frequently Asked Questions
What is the difference between SUMIF and SUMIFS?
SUMIF takes one condition. SUMIFS takes one or more, with a different argument order: the sum range comes first, followed by pairs of criteria range and criteria. Use SUMIFS whenever you have more than one condition.
Can SUMIF match partial text?
Yes. Wildcards work in the criteria: "North*" matches anything starting with North, "*North*" matches anything containing it, and "?orth" matches any single character followed by orth.
Does SUMIF work across multiple sheets?
Yes, as long as you reference the sheet name in both ranges, for example SUMIF(Data!B2:B100, "North", Data!C2:C100). If the sheet name contains spaces, wrap it in single quotes, like 'Sales Data'!B2:B100.
Why does SUMIF ignore some rows?
Rows are skipped when the sum cell is text, empty, or an error. The formula only adds numeric values, so blank cells and text entries contribute nothing.
Can I use SUMIF to count instead of sum?
Not directly. If you only need a count of matching rows, use COUNTIF with the same range and criteria structure.
Is SUMIF case-sensitive?
No, SUMIF treats North and north the same way. If you need case-sensitive matching, you would have to use a different approach such as SUMPRODUCT with EXACT rather than SUMIF.