IF Function using different criteria under the same column

Hello everybody,

I need your help with IF Function

smartsheet2.png

. I have 5 criteria under the Country column and I want to assign codes for each country. So,

IF is โ€œChileโ€ then code to be 9

IF is โ€œChinaโ€ then code to be 8

IF is โ€œColombiaโ€ then code to be 7

IF is "Costa Rica" then code to be 6


Iโ€™ve been trying numerous times to group them in a single formula but I get unparseable error

=IF([Country1]@row = โ€œChile", 9),

Tags:

Best Answer

  • SueinSpain
    SueinSpain โœญโœญโœญโœญโœญโœญ
    Answer โœ“

    I find rather than using a lot of complicated IFs ina formula you can often achieve the same result by using automation and setting a cell value.

    For example every smartsheet I have I have a unique ref column that is auto generated

    So I have automations that when this is added or changes to any value - as the trigger

    the conditions If Country1 = Chile set field = 9

    for each if there is an Otherwise brance so this is If Country1 = China set field = 8

    the last otherwise - I usually use to send a notification to and admin saying we have a country1 not catered for please investigate


    I personally find these easier to understand and document than complex formula

    image.png

    Hope this helps

    Sue Rogers

    MWI Animal Health UK - Cencora

    Business Analyst

Answers

  • Andrรฉe Starรฅ
    Andrรฉe Starรฅ Community Champion

    Hi @EgliAlv

    I hope you're well and safe!

    Try something like this.

    =
    IF([Country1]@row = "Chile", 9, IF([Country1]@row = "China", 8, 
    IF([Country1]@row = "Colombia", 7, IF([Country1]@row = "Costa Rica", 6, 
    IF([Country1]@row = "Croatia", 5)))))
    

    Did that work/help?

    I hope that helps!

    Be safe and have a fantastic week!

    Best,

    Andrรฉe Starรฅ | Workflow Consultant / CEO @ WORK BOLD

    โœ…Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!

    SMARTSHEET EXPERT CONSULTANT & PARTNER

    Andrรฉe Starรฅ | Workflow Consultant / CEO @ WORK BOLD

    W: www.workbold.com | E: andree@workbold.com | P: +46 (0) - 72 - 510 99 35

    Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

  • EgliAlv
    EgliAlv โœญโœญ

    Hello Andree,

    Thanks for your help. I keep getting unparseable error when I add 2 criteria onwards. It works with only 1 criteria, but getting messy when I add other conditions. I thought itโ€™s about the formatting of double quotes (โ€œ โ€) instead of (" โ€œ), but I change it and I still get errors. Do you think it could be due to another text format errors?

  • Zisun Mahmud Zihad
    Zisun Mahmud Zihad โœญโœญ
    edited 02/24/22

    Hi @EgliAlv,

    It would be great to see the current formula you've gotten the error with. It might be the brackets.


  • SueinSpain
    SueinSpain โœญโœญโœญโœญโœญโœญ
    Answer โœ“

    I find rather than using a lot of complicated IFs ina formula you can often achieve the same result by using automation and setting a cell value.

    For example every smartsheet I have I have a unique ref column that is auto generated

    So I have automations that when this is added or changes to any value - as the trigger

    the conditions If Country1 = Chile set field = 9

    for each if there is an Otherwise brance so this is If Country1 = China set field = 8

    the last otherwise - I usually use to send a notification to and admin saying we have a country1 not catered for please investigate


    I personally find these easier to understand and document than complex formula

    image.png

    Hope this helps

    Sue Rogers

    MWI Animal Health UK - Cencora

    Business Analyst

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!