IF Function using different criteria under the same column

Options

Hello everybody,

I need your help with IF Function

. 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 ✓
    Options

    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

    Hope this helps

    Sue Rogers

    AmerisourceBergen - MWI Animal Health

    Business Analyst

Answers

  • Andrée Starå
    Andrée Starå ✭✭✭✭✭✭
    Options

    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
    Options

    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
    edited 02/24/22
    Options

    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 ✓
    Options

    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

    Hope this helps

    Sue Rogers

    AmerisourceBergen - MWI Animal Health

    Business Analyst

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!