Cocokkan beberapa nilai, kembalikan kecocokan pertama
=SWITCH(expression, val1/result1, [val2/result2], ..., [default])
| Parameter | Deskripsi |
|---|---|
expression |
The value or expression to match against. |
val1/result1 |
The first value and result pair. |
val2/result2 |
[optional] The second value and result pair. |
default |
[optional] The default value to use when no match is found. |
In the example shown, the formula in D5 is:
=SWITCH(C5,1,"Poor",2,"OK",3,"Good","?")
SWITCH only performs an exact match, so you can't include logical operators like greater than (>) or less than (
=SWITCH(TRUE,A1>=1000,"Gold",A1>=500,"Silver","Bronze")