Excel if multiple conditions

Copper Contributor

Hello, I want to know if I have master contact list, and there is a row indicated member’s country of birth, if I will like to change the answer into the following codes in the list, say USA=1, CHINA=2, INDIA=3, UK=4, GERMAN=5, ITALY=6… should I use If formula? Thank you so much.

1 Reply

@Hellomimi 

The best solution may depend on the number of countries to be considered in the workbook. If you only have 6, you could use SWITCH:

=SWITCH(A1,"USA",1,"CHINA",2,"INDIA",3,"UK",4,"GERMANY",5,"ITALY",6,"no such")

 

If the list is much longer you might consider creating a dedicated lookup table in the sheet and then use XLOOKUP.