function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LogoJonLogoJon 

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.
NPMNPM
You may want to explore using CASE
LogoJonLogoJon
case is great... however i'm using number fields (currency) so that i can use them in a rollup summary to a parent object.
Jeff TalbotJeff Talbot

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!
LogoJonLogoJon
Thank you!
PRIYANKA K2PRIYANKA K2
I created a  formula field anyone knows that why it is not working ?
 CASE(Opportunity_Id__r.Account_LOB__c,
"CB","a",
"EGB","b",
"GB","b",
"null")