Sum the values in a column if all the conditions are true.

Usage

SumIf(number, condition 1, [condition 2], ...)

number (required) Column of numbers to add together. Null values are skipped.

condition 1 (required) Logical condition that returns a result that is either True or False. If the condition is True, the number on the corresponding row is added to the sum.

condition 2 (optional) Additional conditions can be added after the first condition.

Note: In the case of multiple conditions the "AND" logical operator is used by default. In order to use an "OR" operator the conditions should be encapsulated in parenthesis chained by an explicit "OR".

Examples

SumIf( [Sales], [State] = "TX" )
  • Returns the sum of all the sales in Texas.
SumIf( [Sales], ([State] = "TX" OR [State] = "CA"))
  • Returns the sum of all the sales in Texas and California.
SumIf( [Sales], [State] = "TX", [CustomerID] = "1234" )
  • Returns the sum of all the sales in Texas for customer ID "1234".

 

See Also