The SUM function returns the sum of the values that meet the given criterion.
This is a useful function for data analysis when you need to consider only those values that satisfy a given condition.
Syntax
SUMIF(range, criterion, [sum_range])
Argument |
Description |
Permitted values |
|---|---|---|
range |
Range that is checked for compliance with the “criterion” argument |
Any numerical ranges or arrays |
criterion |
Condition against which the value of the “range” argument is checked |
Number, text, cell reference, or expression: •Equal to: “text”, 1, “=text”, or “=1” •Greater than: “>1” •Greater than or equal to: “>=1” •Less than: “<1” •Less than or equal to: “<=1” •Not equal to: “<>1” or “<>text” •Text with wildcards “?” and “*” |
[sum_range] |
(optional) Range whose values are summed if the corresponding values from the first range satisfy a specified condition |
Any numerical ranges or arrays |
Examples of use
Summing values with a simple criterion
If there are numbers in the range A1:A10 and you want to sum those that are greater than 10:
=SUMIF(A1:A10, ">10")
Sums the values from cells A1:A10 that are greater than 10.
Summing values with a text criterion
If the range A1:A10 contains product names and B1:B10 contains their sales, and you want to sum the sales for the Apple item:
=SUMIF(A1:A10, "Apple", B1:B10)
Sums the sales for “Apple” from the range B1:B10.
Summing using a cell reference
If cell D1 contains a value and you want to sum all values in the range B1:B10 that match the criteria in A1:A10:
=SUMIF(A1:A10, D1, B1:B10)
Sums the values in B1:B10 if the corresponding values in A1:A10 are equal to the value in D1
Notes
–The SUMIF function ignores empty cells in the range.
–Make sure the ranges are of the same size to avoid errors.