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
Amanda JonesAmanda Jones 

HOW TO ENTER A NEGATIVE PICKLIST VALUE IN A CASE STATEMENT?

I have a huge formula compiled size 4,628 characters that I am trying to condense.
I think I can do it by stating the negative of a picklist value, but I'm not sure how to do it. Here is my formula:

CASE(text(Deployment_No__c),
"2",STI_Monthly_Cost__c + Cost_for_Discounted_Adults__c + Cost_of_Children__c + Addtl_Lodging_Cost_Total__c + Addtl_Cost_Incidentals__c + STI_Daily_Cost__c-Applied_Credit__c,
"3",STI_Monthly_Cost__c + Cost_for_Discounted_Adults__c + Cost_of_Children__c + Addtl_Lodging_Cost_Total__c + Addtl_Cost_Incidentals__c + STI_Daily_Cost__c-Applied_Credit__c,
0)

I want to rewrite the formula so that it will calculate if the picklist value is NOT "1". That way I can use each of them only once.

Looking forward to your brilliant answers! :)
Best Answer chosen by Amanda Jones
Jason BealJason Beal
How's this look? If the expression is 1 return 0 otherwise return your calculation.

CASE(text(Deployment_No__c),
"1",0,
STI_Monthly_Cost__c + Cost_for_Discounted_Adults__c + Cost_of_Children__c + Addtl_Lodging_Cost_Total__c + Addtl_Cost_Incidentals__c + STI_Daily_Cost__c-Applied_Credit__c)

All Answers

Jason BealJason Beal
How's this look? If the expression is 1 return 0 otherwise return your calculation.

CASE(text(Deployment_No__c),
"1",0,
STI_Monthly_Cost__c + Cost_for_Discounted_Adults__c + Cost_of_Children__c + Addtl_Lodging_Cost_Total__c + Addtl_Cost_Incidentals__c + STI_Daily_Cost__c-Applied_Credit__c)
This was selected as the best answer
Amanda JonesAmanda Jones
Perfect! Compiled size 2,183. You're the man. :)