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
Lukasz PiziakLukasz Piziak 

Case formula with two criteria.

Hi, 
I'm looking for help with creating CASE formula to work with two criterias:
Below formula is working fine,
CASE( SCMC__Production_Order__c.Label_Band_Colour__c ,'Red', Red Band ,'Black', Black Band, N/A)

What if I would like to add another criteria to formula above? e.g
CASE( SCMC__Production_Order__c.Label_Band_Colour__c ,'Red', Red Band ,'Black', Black Band, N/A)
OR
CASE( SCMC__Production_Order__c.Body_Colour__c ,'Red', Red Body ,'Black', Black Body, N/A)

Thanks for any help with this

Regards
Lukasz
Best Answer chosen by Lukasz Piziak
LBKLBK
In that case, a CASE statement won't help you.

Here is your new formula.
 
if(SCMC__Production_Order__c.Label_Band_Colour__c  = 'Red', Red Band ,
if(SCMC__Production_Order__c.Label_Band_Colour__c  = 'Black', Black Band,
if(SCMC__Production_Order__c.Body_Colour__c = 'Red', Red Body ,
if(SCMC__Production_Order__c.Body_Colour__c = 'Black', Black Body, N/A))))
Let me know if this help.
 

All Answers

LBKLBK
What would be the output you are expecting?
In my opinion, these two formulas have two different output.
One formula based on Label_Band_Colour__c gives out a Band color (Red Band, Black Band or N/A).
Another formula based on Label_Body_Colour__c gives out a Body color (Red Body, Black Body or N/A).

Will your combined formula give out only one output?
Lukasz PiziakLukasz Piziak
Yes, it would be only one output.
LBKLBK
What would be the output?

Say, if Label_Band_Colour__c = Red and Label_Body_Colour__c = red, what would be the output?

What if Label_Band_Colour__c = Red and Label_Body_Colour__c = black?

Can you elaborate on the use case a little?
 
Lukasz PiziakLukasz Piziak
Sorry, it will never happen that both option would be selected. So If someone is selecting the banner colour will never select the body colour.
 
LBKLBK
In that case, a CASE statement won't help you.

Here is your new formula.
 
if(SCMC__Production_Order__c.Label_Band_Colour__c  = 'Red', Red Band ,
if(SCMC__Production_Order__c.Label_Band_Colour__c  = 'Black', Black Band,
if(SCMC__Production_Order__c.Body_Colour__c = 'Red', Red Body ,
if(SCMC__Production_Order__c.Body_Colour__c = 'Black', Black Body, N/A))))
Let me know if this help.
 
This was selected as the best answer