How to Use SUMIF in Excel: Summing Data by Condition
Use a sales table to explain clearly the three arguments of the SUMIF function, its complete syntax, and common errors. Also compare it with SUM and COUNTIF, so you can quickly sum amounts by a single condition.
Key points of this article
- The SUMIF format is =SUMIF(criteria range, criteria, sum range); its three arguments answer "where to look," "what to find," and "which column to add."
- When the criterion is text, wrap it in English double quotes, such as "East China"; when the criterion is written in a cell, reference the cell address directly.
- The criteria range and the sum range must have the same number of rows; otherwise the results will be misaligned or an error will occur.
- For counting quantities, use COUNTIF; if no condition is needed, use SUM; use SUMIF only when you need to add amounts based on one condition.
- After finishing, manually add up one category to verify the result, and check that the numbers are genuine numeric values.
If you have a long list of sales records and want to know how much a certain department sold in total, adding up row by row is both slow and error-prone. This is when you need the conditional summing function SUMIF. Readers who search for "how to use the SUMIF function in Excel" are most likely at this stage: they know how to do a plain sum with SUM, but don't yet know how to add up only the rows that meet a condition.
This article is for readers who already know how to use SUM but have not yet mastered conditional summing. Using a sales table with 7 rows, we explain the SUMIF arguments, the complete syntax, and common errors, and compare it with SUM and COUNTIF. Follow the examples step by step, and you will be able to apply it to your own spreadsheets.
How to use SUMIF? One-sentence conclusion
SUMIF works by first telling it which column to search for the condition, then telling it which column to sum when the condition is met. The format is =SUMIF(range, criteria, [sum_range]), where the sum range can be omitted, in which case the range itself is summed. The table below gives recommended approaches for common situations.
| Your situation | Recommended Practices | Cause |
|---|---|---|
| Sum by a text condition, such as for a certain department | Use SUMIF, write the criteria as text, and enclose it in English double quotes. | One condition, one function; keep the code short. |
| The conditions need to be changed frequently. | Put the condition in a cell, and reference that cell in the formula. | Change one cell, and the result refreshes automatically. |
| Count how many rows meet the condition, not the amount. | COUNTIF | It returns the count, not the sum of the values. |
| Sum all the data, with no conditions. | SUM | No judgment conditions are needed. |
| The condition is a numeric range, such as an amount greater than 1000 | SUMIF with comparison operators | The comparison symbols are written inside double quotes, e.g., ">=1000" |
Before You Begin: Confirm These Points
- Check whether the amount column contains real numbers. If the figures were copied from a web page or PDF as text, the cells are usually left-aligned. SUMIF skips text values, so the total comes out too small. Look at the alignment before you do anything else.
- Check that the criteria exactly match the text in the table. "East China" and "East China " (with a trailing space) are different to Excel, and full-width and half-width characters are also different. When a match fails, the result is 0.
- Check that the two ranges have the same number of rows. The criteria range and the sum range should start on the same row and cover the same number of rows. For example, if the criteria uses A2:A8, the sum should use C2:C8. Don't have one end at row 8 and the other at row 20.
- Check whether the data came from a PDF. If the sales table is a PDF, first confirm whether its text can be selected. For scanned files, run OCR first, then export to an Excel spreadsheet. Desktop PDF editors can do both steps, but the recognition results need to be checked manually.
Steps to Summarize Sales by Department Using SUMIF in Excel
Suppose a sales table is as follows: row 1 is the header, the data is in rows 2 through 8, column A is the department, and column C is the sales amount.
| Department | Salesperson | Sales revenue |
|---|---|---|
| East China | Wang Fang | 1200 |
| North China | Li Qiang | 800 |
| East China | Zhao Min | 950 |
| South China | Chen Lei | 600 |
| North China | Zhou Ting | 1100 |
| East China | Wu Dong | 400 |
| South China | Zheng Kai | 700 |
- In an empty cell, type an equals sign and the function name: type =SUMIF( to tell Excel you want to perform a conditional sum.
- Select the criteria range: drag with the mouse from A2 to A8. This is the column containing the departments, where Excel will check each row against the condition.
- Enter the condition: first type an English comma, then type "East China". Text conditions must be enclosed in English double quotation marks.
- Select the sum range: type another English comma, then drag from C2 to C8, which are the sales amounts to be added.
- Add the closing parenthesis and press Enter. The formula is =SUMIF(A2:A8,"East China",C2:C8), and the result is 2550, which is the sum of the three East China sales: 1200, 950, and 400.
- Verify with a different condition: change "East China" inside the double quotation marks to "North China". The result should be 1900, which matches the hand calculation of 800 plus 1100.
If you want the condition to be changeable at any time, you can write the department name in cell F2 and change the formula to =SUMIF(A2:A8,F2,C2:C8). From then on, you only need to change the content of F2, and the result will update automatically.
Verify each item after completion
After receiving the results, do not use them directly. Check each item against the table below.
| Checklist items | How should I look at it? | What should I do if I have a problem? |
|---|---|---|
| Is the result 0? | Are the condition characters exactly the same as those in the table? | Remove extra spaces and unify full-width and half-width characters. |
| Is the result smaller than expected? | Should the numbers in the summation area be left-aligned? | Convert the textual numbers to numeric values, then recalculate. |
| Official error report | Do the two regions have the same number of rows? | Change the two regions to the same number of rows |
| The results do not match the hand calculations. | Verify a classification by adding up the numbers by hand. | Check line by line for missing rows, or for having selected the wrong column. |
| Data comes from PDF | Spot-check a few numbers to see whether they match the original file. | Scanned documents should be OCR'd first, and the recognition results need manual review. |
📊 Core Comparison: How to Choose Between SUM, COUNTIF, and SUMIF
Three commonly used Excel functions related to "summing" differ in whether they take a condition and whether they compute a count or an amount. A side-by-side comparison using the same table is shown below:
| Function | Function | Example | Result |
|---|---|---|---|
| SUM | Sum all the numeric values in the selected range. | =SUM(C2:C8) | 5750 |
| COUNTIF | Count the number of cells that meet the condition | =COUNTIF(A2:A8,"East China") | 3 |
| SUMIF | Sum the corresponding values that meet the condition. | =SUMIF(A2:A8,"East China",C2:C8) | 2550 |
The three can be used together. For example, use COUNTIF to find that East China has 3 sales, then use SUMIF to get a total of 2550, and then divide the total by the number of sales to get the average amount per sale for East China.
❓ Frequently Asked Questions (FAQ)
1. Can the third argument of SUMIF be omitted?
Yes. When the sum range is omitted, Excel sums the numeric values in the criteria range itself that meet the condition. For example, =SUMIF(C2:C8,">=1000") sums the numbers in column C that are greater than or equal to 1000, and the result is 2300.
2. How do I write "greater than," "less than," or "contains" certain characters in a condition?
The comparison conditions are written inside double quotes, such as ">=1000" and "<500". For containment relationships, you can use the wildcard ; for example, "Hua" matches all departments starting with "Hua", and in this example the result is 5750.
3. Is SUMIF case-sensitive?
Case is not distinguished. The English "east" and "East" will be treated as the same condition.
4. What should I do if two conditions must be met at the same time?
SUMIF can only handle one condition. When you need two or more conditions, use the SUMIFS function, whose arguments are ordered with the sum range first, followed by each pair of criteria range and criteria.
📝 Summary
SUMIF sums values based on one condition. The key is aligning three arguments: the criteria range, the criteria, and the sum range. It's a good idea to practice on a small table first, make sure you've mastered how to use the SUMIF function in Excel, then apply it to real data, and verify the result once by adding the values manually.


