The Everyday Function: Case()

Formulas in Salesforce are an awesome admin tool but can sometimes be difficult to understand.  This blog series, ‘The Everyday Function’ by Tom Hoffman, brings Salesforce formulas down from the cloud and into everyday life. ”The Everyday Function’ will first be published as part of Spark.Insights at 

The Everyday Function: Case

The CASE() function is a powerful Salesforce tool that allows users to simplify formula writing, stay within compile limits, and create cleaner, easier to read functions versus using long and clunky nested IF() statements.

It’s also a little confusing, so let’s bring it into the real world.

My wife, Mary, says she is going out shopping.  I ask her where she is going, she, of course, says, ‘not sure, just out, need a few things.’  Well, I also need a few things.

So I say, ‘Ok Mary, if you are going to the mall, can you grab me some of those fun socks I like? If you are going to swing by Target (because you KNOW that is happening) I need some deodorant.  If you are not going to either place, can you at least bring me home some unsweetened green tea from the 7/11 on the corner? Thanks”!

This is a Case function!

Case(WifeDestination, ‘Mall’‘Fun Socks’, ‘Target’, ‘Deodorant’, ‘Green Tea’)


A case function has 4 components:

1: Expression: the condition you are evaluating

2: Result: the value you are checking for

3: Return: what you want to return for each value

4: Catch-all: if none of these defined results are true, then do this

Leave a Reply

Your email address will not be published. Required fields are marked *