Forum Discussion

Hellomimi's avatar
Hellomimi
Copper Contributor
Nov 15, 2023

Excel if multiple conditions

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

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    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.

Resources