SUMIF

Sum a range based on one criterion.

Parameter List

Syntax
SUMIF(rangecriterion
[sum_range]
)
range

The range of conditional values to check against criterion. For example: A1:A5.

criterion

The pattern or test to apply to range. For example: ">5".

[optional] sum_range

The range of values to add to the sum. Must be the same size as range. For example: B1:B5.

More details
  • If range contains strings then criterion must be a string.

  • You can use wildcards in criterion. To match any singular character, use ?. To match zero or more characters, use *. If you want to match an actual question mark or asterisk, prefix it with a tilde. For example: "What~?".

  • If criterion is a string, each cell in range is checked to see if it is equal to it (or matches it, if wildcards are used).

  • If range contains numbers, criterion can be either a string or number.

  • If criterion is a number, each cell in range is checked to see if it is equal to it.

  • If you want to use operators, such as = or >, then criterion must be a string. For example: ">50".

Examples

SUMIF(A1:A5, ">20") returns 50, as only A1 and A5 are greater than 20.Example 1