Skip to main content

Hi all! 

 

I have a few picklist values and I am trying to segment them into two categories via a text formula field.  

 

An example of this would be using a picklist field of "food item", with picklist values of "banana", "apple", "celery", "carrot",  and then a text value to segment them into either "fruit" or "vegetable" for the text formula field. Obviously I can make it a dependent picklist but the goal would be to not have a field that needs manual updating or something that requires a flow.  

 

Is it possible to achieve through a formula field? 

1 answer
  1. Mar 13, 11:07 PM

    Yes, this is a perfect example of when to use the case function in a formula field.  It would look something like this:

    CASE(TEXT(Food_Item__c),

    "banana","fruit",

    "apple","fruit",

    "celery","vegetable",

    "carrot","vegetable",

    ""

    )

     

    Here's a link to the reference documentation for the case function: 

    CASE

0/9000