Excel SUM, SUMIF, and SUMIFS for totals with and without criteria
In Excel, use SUM to add all values, SUMIF for a single condition, and SUMIFS to add only rows that meet every specified condition. You can also use SUMIFS with one condition. Its sum range goes in a different position than in SUMIF.
Set up the sample data
Enter the headers and six sample rows in A1:C7. Column A contains a group number, column B a type, and column C the quantity to add. Enter each formula in a blank cell outside the table.
| Group | Type | Quantity |
|---|---|---|
| 1 | A | 20 |
| 1 | A | 80 |
| 1 | A | 60 |
| 1 | B | 40 |
| 2 | B | 20 |
| 2 | B | 50 |
Add every value with SUM
=SUM(C2:C7)
The six quantities in C2:C7 add up to 270. You can also supply separate ranges as individual arguments. Numbers stored as text in a referenced range can be left out of the total. If the total looks too low, convert those entries to actual numbers and check again.
Microsoft’s SUM function reference
Use SUMIF for one condition
=SUMIF(A2:A7,1,C2:C7)
=SUMIF(C2:C7,">=60")
The first formula adds the quantities in column C for rows where column A equals 1, giving 200. The range to test comes first and the range to add comes last. The second formula leaves out the sum range, so it tests and sums column C itself. Only 80 and 60 are at least 60, giving 140.
Microsoft’s SUMIF function reference
Use SUMIFS when every condition must match
=SUMIFS(C2:C7,A2:A7,1,B2:B7,"A")
Supply C2:C7 first, then add each range and its condition as a pair. The first three data rows have both group 1 and type A, so their total is 160. The row with quantity 40 belongs to group 1 but is excluded because its type is B.
Microsoft’s SUMIFS function reference
Check criteria and range alignment
To use an adjustable threshold, enter 60 in D2 and use the final formula. The & joins the comparison operator to the value in D2, giving 140. Put literal text and comparisons inside double quotes. If Excel rejects the separator between arguments, use the list separator in your regional settings.
=SUMIF(C2:C7,">="&D2)
Start and end each criteria range on the same rows as the sum range. SUMIFS also requires the ranges to be the same size. In a text criterion, * matches any sequence and ? matches one character. Use ~* for a literal asterisk. Filtering rows out of view does not exclude them from these totals.




