Using the Switch Function to change values to text or the oposite

Easily add values of certain cells meeting certain cirteria.
Català – Castellano – Deutsch
The SWITCH function in Excel is a logical function that returns a value based on a list of expressions and corresponding values. The function takes the following syntax:

SWITCH(expression, value1, result1, [value2, result2], … [default])

The ‘expression’ is the value that you want to test, ‘value1’ and ‘result1’ are the first test and corresponding result, [value2, result2] are the second test and result, and so on. If none of the tests are true, the function will return the ‘default’ value.

Here’s an example of how you can use the SWITCH function in a practical situation:

Suppose you have a list of product codes in column A and you want to return the corresponding product name in column B. You can use the SWITCH function to do this. In cell B2, you would enter the following formula:

=SWITCH(A2, “P1”, “Product 1”, “P2”, “Product 2”, “P3”, “Product 3”, “P4”, “Product 4”, “Unknown”)

In this…
Read more