SWITCH
Last updated
Was this helpful?
The SWITCH function evaluates an expression against a list of values and returns the result corresponding to the first matching value. If no match is found, an optional default value is returned.
SWITCH(expression, val1, res1, val2, res2, ..., val_n, res_n, default)expression: The expression to evaluate.
val1, val2, … val_n: The values to compare against the expression.
res1, res2, … res_n: The result to return for each matching value.
default (Optional): The value to return if no match is found.
Returns the result corresponding to the first matching value. If no match is found, returns the default value (if specified).
SWITCH(Sub-Category, "Bookcases", 4.55, "Chairs", 2.67, "Tables", 2.81, "Art", 1.35,
"Paper", 3.79, "Machines", 10.55, "Envelopes", 1.23, "Storage", 2.53, 0)Evaluates the Sub-Category value and returns the corresponding numeric value for each match; if no match is found, returns 0.

Last updated
Was this helpful?
Was this helpful?