ifs

Returns the first true result from a series of logical tests in Salesforce Spiff. This function is similar to multiple if() functions. You can include multiple conditions and return different values based on the result of each condition.

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

ifs(list_of_condition_value_pairs)

Arguments

Argument Required? Description
list_of_condition_value_pairs Required A list of each condition to test and each value to return, enclosed in brackets and separated by commas, such as [condition 1, value 1, condition 2, value 2].

Example

A rep is paid a commission rate for each opportunity, but the rate depends on the opportunity's ARR.

  • If the ARR exceeds $30,000, the rep receives a 10% rate.
  • If the ARR is under $20,000, the rep receives an 8% rate.
  • If the ARR is under $10,000, the rep receives a 6% rate.
=ifs([ARR >= 30000, 10%, ARR >= 20000, 8%, true, 6%])

Because this function returns the first condition that's true, carefully arrange your test conditions so that the most exclusive condition is first. If the ARR is greater than $30,000, both the first and second conditions are true, but you make to make sure that you return the 10% rate, not 8%.

To provide a catch-all condition or fallback value when all other conditions are false, the last condition can always be true.

See Also