SUMIF function

SUMIF adds the cells specified by the given criteria. This function is used to browse a range when you search for a certain value.

Syntax

SUMIF(range, criteria, sum range)

  • range is the range to which the criteria are to be applied.
  • criteria is the cell in which the search criterion is shown, or the search criterion itself. If the criteria is written into the formula, it must be surrounded by double quotation marks. Criteria can also include wildcard characters. To represent any single character, use ? (question mark) in the text that specifies the condition. To represent any number of consecutive characters, use * (asterisk). For example, use B* to match all entries that begin with B, and B??? to match all entries that begin with B and contain three other characters. To represent an actual question mark or asterisk, use ~ (tilde) to precede the ? or *.
  • sum range is the range from which values are summed. If this parameter has not been indicated, the values found in the range are summed.

Example

To sum up only negative numbers: =SUMIF(A1:A10,"<0")

=SUMIF(A1:A10,">0",B1:10) sums values from the range B1:B10 only if the corresponding values in the range A1:A10 are >0.

See COUNTIF() for syntax examples that can be used with SUMIF().