SumIf
The SumIf function adds the numbers in a column if all the conditions are true for that row.
The SumIf function is an aggregate function.
Aggregate functions evaluate one or more rows of data and return a single value.
In a table element, the aggregate is calculated for each grouping. For information on how to add a grouping with an aggregate calculation to a table, see Group columns in a table.
In a table with no groupings, the aggregate is calculated for each row. For information on how to calculate summary statistics across all rows in a table, see Add summary statistics to a table.
To learn more about using aggregate functions, see Building complex formulas with grouped data.
Syntax
SumIf(field, condition 1, [condition 2], ...)
Function arguments:
- field (required) - The column of numbers to add together. Null values are skipped.
- condition 1 (required) - The 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. Note: you can use operators in conditions.
- condition 2 + (optional) - Additional conditions can be added after the first condition.
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 a single condition chained by an explicit "OR".
Examples
SumIf([Sales], [State] = "TX" )
Returns the sum values in the Sales column if the State column value is TX.
SumIf([Sales], [State] = "TX" OR [State] = "CA")
Returns the sum of values in the Sales column if the State column value is TX or CA.
SumIf([Sales], [State] = "TX", [CustomerID] = "1234" )
Returns the sum of values in the Sales column if the State column value is TX and the CustomID column value is 1234.
SumIf([Sales], [State] = [list-control-state])
Returns the sum of values in the Sales column if the State column value matches the value selected in the list-control-state control element.
Updated 18 days ago
