You are here:
sum
Calculates a total value from a list of numbers in Salesforce Spiff. This function works well with records in a data filter.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
| Available for an additional cost in: Professional Edition with Web Services API Enabled |
Syntax
The syntax and arguments change depending on the input data.
sum(list_or_range)sum(filter!column_or_field)sum(filter, condition, column_or_field)Arguments
| Argument | Required? | Description |
|---|---|---|
| list_or_range | Required if summing a list | The list or range to sum. Enclose a list in brackets with comma-separated values. |
| filter | Required if summing a data filter | The data filter with records that you want to sum. |
| column_or_field | Required if summing a data filter | An expression that specifies the column or field from the filter's records that you want to sum. |
| condition | Optional | An expression that specifies a condition that must be true for the function to calculate a sum. If you specify a condition, it must be the second argument. |
Considerations
This function supports an optional condition, but we recommend that you use the sumif() function instead for sums that include a condition. The sumif() function better describes the result of the formula that uses it, which is useful for internal accountability.
Example
Sum a list of numbers.
=sum([1, 2, 3])Sum the value of the ARR__c field from records in the ClosedInPeriod data filter.
=sum(ClosedInPeriod!ARR__c)Sum the value of the ARR__c field, but only if the ARR__c value is greater than $25,000.
=sum(ClosedInPeriod, ARR__c > 25000, ARR__c)Sum the value of the TotalContractValue field, but only if the ARR__c value is greater than $25,000.
=sum(ClosedInPeriod, ARR__c > 25000, TotalContractValue)
