CASE Function in Salesforce: Syntax and 9 Formula Examples

The CASE function in Salesforce compares one field or expression with a list of exact values and returns the result paired with the first match, or a default when nothing matches:

CASE(expression, value1, result1, value2, result2, ..., else_result)

CASE works in formula fields, validation rules and default values, and it reads picklists directly. Below are nine copyable CASE formulas, seven of them built in Ridgeline Supply’s Winter ’27 Developer Edition org, plus the two editor errors you will see first.

This Tutorial Covers: