Hi CC_411,
Thanks for visiting Microsoft Community.
For your question, the SWITCH function is a very suitable solution. It can map multiple text values to corresponding numerical values, and its syntax is concise and intuitive. Here is the specific usage:
=SWITCH(text_cell, "text1", value1, "text2", value2, ..., default_value)
Assuming your responses are in column A (e.g., "White", "Female", etc.), you can use the following formula in column B:
=SWITCH(A2, "White", 1, "Female", 1, "Black", 2, "Male", 2, 0)
- If A2 is "White" or "Female", it returns 1.
- If A2 is "Black" or "Male", it returns 2.
- For other cases, it returns 0 (default value).
Notes:
- Ensure that the text values' case and format match those in the formula.
- If there are many mapping relationships, it is recommended to use
VLOOKUPorXLOOKUPin combination with a mapping table.
I hope this method helps you complete your task efficiently! If you have any other questions, feel free to ask.
Best Regards,
Jonathan Z - MSFT | Microsoft Community Support Specialist