Minimum Origin Version Required: 2019 SR0
This function is used to compare a value expression to a set of values val. If match is found, return the corresponding res. Up to 39 comparing values are supported. If no match is found, default value will be returned.
string switch(string expression, double val1, string res1$[, double val2, string res2$]...[, double val39, string res39$][,string default$])$
double switch(string expression, double val1, double res1[, double val2, double res2]...[, double val39, double res39][, double default])
expression
valn
resn
default
Return value res when the corresponding value val is found in expression.
Ex1
IF value in col(A) is Apple, returns Fruit, if Boy, returns People, if Cat returns Animal.
switch(A$,"Apple","Fruit","Boy","People","Other")$