The SUMIF
function in Microsoft Excel is used to sum the values in a range that meet a specific condition. Here's how to use it:
Syntax:
SUMIF(range, criteria, [sum_range])
Parameters:
range
: The range of cells you want to evaluate against the criteria.criteria
: The condition that determines which cells to include in the sum. This can be a number, expression, text, or a cell reference.sum_range
(optional): The actual range of cells to sum. If omitted, Excel sums the cells in therange
parameter.
Example 1: Basic Usage
Problem: Sum all sales greater than 100.
A | B |
---|---|
Sales | Region |
50 | North |
200 | East |
150 | West |
80 | South |
Formula:
=SUMIF(A2:A5, ">100")
Result: 350
(sum of 200 and 150).
Example 2: Using a sum_range
Problem: Sum sales in the "East" region.
A | B | C |
---|---|---|
Sales | Region | Month |
50 | North | Jan |
200 | East | Feb |
150 | West | Mar |
80 | South | Apr |
Formula:
=SUMIF(B2:B5, "East", A2:A5)
Result: 200
(sum of sales in the "East" region).
Key Notes:
-
Wildcard Usage:
- Use
?
to represent any single character. - Use
*
to represent any sequence of characters. - For example,
=SUMIF(A2:A5, "*West")
sums cells that end with "West."
- Use
-
Criteria in Another Cell:
- Use a reference for criteria:
=SUMIF(A2:A5, ">" & D1)
, whereD1
contains the threshold value.
- Use a reference for criteria:
-
Handling Text Criteria:
- Text criteria must be enclosed in quotes (e.g.,
"East"
).
- Text criteria must be enclosed in quotes (e.g.,
Here are more examples to illustrate different ways to use the SUMIF
function in Microsoft Excel:
Example 3: Sum Based on Numeric Criteria
Problem: Sum sales greater than or equal to 100.
A | B |
---|---|
Sales | Region |
50 | North |
200 | East |
150 | West |
80 | South |
Formula:
=SUMIF(A2:A5, ">=100")
Result: 350
(sum of 200 and 150).
Example 4: Sum Based on Text Criteria
Problem: Sum sales for the "North" region.
A | B |
---|---|
Sales | Region |
50 | North |
200 | East |
150 | West |
80 | South |
Formula:
=SUMIF(B2:B5, "North", A2:A5)
Result: 50
(sum of sales in the "North" region).
Example 5: Using Cell Reference for Criteria
Problem: Sum sales greater than the value in cell D1
.
A | B | D |
---|---|---|
Sales | Region | Criteria |
50 | North | 100 |
200 | East | |
150 | West | |
80 | South |
Formula:
=SUMIF(A2:A5, ">" & D1)
Result: 350
(sum of 200 and 150 because both are greater than 100).
Example 6: Using Wildcards
Problem: Sum sales for regions ending in "st."
A | B |
---|---|
Sales | Region |
50 | North |
200 | East |
150 | West |
80 | South |
Formula:
=SUMIF(B2:B5, "*st", A2:A5)
Result: 350
(sum of 200 and 150 for "East" and "West").
Example 7: Multiple SUMIFs
Problem: Sum sales for "North" and "West."
A | B |
---|---|
Sales | Region |
50 | North |
200 | East |
150 | West |
80 | South |
Formula:
=SUMIF(B2:B5, "North", A2:A5) + SUMIF(B2:B5, "West", A2:A5)
Result: 200
(50 for "North" + 150 for "West").
Example 8: Sum Blank Cells
Problem: Sum sales where the region is blank.
A | B |
---|---|
Sales | Region |
50 | |
200 | East |
150 | West |
80 |
Formula:
=SUMIF(B2:B5, "", A2:A5)
Result: 130
(sum of 50 and 80 where the region is blank).
Example 9: Sum Non-Blank Cells
Problem: Sum sales where the region is not blank.
A | B |
---|---|
Sales | Region |
50 | |
200 | East |
150 | West |
80 |
Formula:
=SUMIF(B2:B5, "<>", A2:A5)
Result: 350
(sum of 200 and 150 where the region is not blank).
These examples cover numeric, text, and wildcard criteria, as well as scenarios involving blank and non-blank cells. Let me know if you'd like help with a specific case!
Examples:
Comments
Post a Comment