<< Click to Display Table of Contents >> SUMIF (sum if condition is true) |
Syntax:
SUMIF(Range, Criterion [, SumRange])
Description:
This returns the sum of those values in a cell range that fulfill the specified criterion.
Range is the cell range to be evaluated.
Criterion is the condition that the values in Range have to fulfill to be included:
Use numbers or text (like "42" or "screws") to obtain the sum of all cells that contain the relevant value.
Use conditions (like ">10" or "<=5") to sum all cells that match the specified condition.
Note: Criteria always have to be enclosed within double quotation marks (").
SumRange (optional) lets you specify the cell range that contains the values to be summed. If SumRange is omitted, the values in Range will be summed.
Example:
The cells A1:A5 contain the values 1, 2, 3, 2, 1.
Then the following applies:
SUMIF(A1:A5, "2") returns 2+2, which is 4
SUMIF(A1:A5, ">=2") returns 2+3+2, which is 7
You enter your daily income in a table as follows:
How much is the sum of the sales if you only consider sales larger than €40?
SUMIF(D2:D5, ">40") results in €100.80
How many flowers of the type "roses" were sold?
SUMIF(C2:C5, "Roses", B2:B5) returns 18
In the above formula, the optional argument SumRange was used: A search was performed on the Range C2:C5 (that is, the type), but the numbers to be added were taken from the SumRange B2:B5 (that is, the number of pieces).
See also: