Reply
Regular Contributor
LogoJon
Posts: 16
0

If else in formula fields

    Is it possible to use else logic in a formula field? I don't see it as an operator.

For example

IF (ISPICKVAL(Quantity, "500")) {69.90
} ELSE IF(....

Thanks.
Super Contributor
NPM
Posts: 560
0

Re: If else in formula fields

You may want to explore using CASE
Regular Contributor
LogoJon
Posts: 16
0

Re: If else in formula fields

case is great... however i'm using number fields (currency) so that i can use them in a rollup summary to a parent object.
Trusted Contributor
TA_Invisible
Posts: 200
0

Re: If else in formula fields

I'm not sure I understand why you can't use CASE as NPM suggested. I've done something very similar to what you are doing -- I have been successful with a formula field that uses the CASE operator, evaulates a picklist, and produces a numeric formula return type. I then use that calculated numerical value in a rollup summary field. Is there something we're missing here? Assuming we are missing something, here's some (hopefully useful) insight on the ELSE inquiry.

Else isn't a defined operator in Salesforce, but it's accomplished using the "value if false" portion of the IF syntax:

IF(logical test, value if true, value if false)

You can string IF statements together, so your else value is simply another IF statement:

IF (ISPICKVAL(Quantity, "500"),"true value 1", IF(ISPICKVAL(Quantity,"400"), "true value 2","final else value"))

Hope that helps!
Regular Contributor
LogoJon
Posts: 16
0

Re: If else in formula fields

Thank you!