Combining IF statements

Options

Hello,


I need some help with combining is statements. I have one column which has two types, that is, Type is the column name and you can choose Type 1 or Type 2. IF it's Type 1, then I would need Primary Name column to return and if it's Type2, then I would need Secondary Name column to return. I was trying this statement:

IF(OR([Type]@row="Type1", [Type]@row="Type"2, Primary Name, Secondary Name)).


I am getting invalid operation. Thanks for your help in advance!!!

Answers

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

    Hi @Deesa Dontamsetti

    I hope you're well and safe!

    Try something like this.

    =IF(Type@row = "Type1", "Primary Name", IF(Type@row = "Type2", "Secondary Name"))
    

    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.

  • AnthroTim
    AnthroTim ✭✭✭✭
    Options

    Hi Deesa,

    I think you have the closing bracket for the OR in the wrong place

    IF(OR([Type]@row="Type1", [Type]@row="Type2"), Primary Name, Secondary Name)
    
    

    Also, Primary Name and Secondary Name should be in Square brackets if they are column names or in quotes if they are a string. I'm not sure what you actually need.

    i.e.

    IF(OR([Type]@row="Type1", [Type]@row="Type2"), [Primary Name]@row, [Secondary Name]@row)
    

    or

    IF(OR([Type]@row="Type1", [Type]@row="Type2"), "Primary Name", "Secondary Name")
    

    However, I don't think that will do what you want. From reading your description, you'd like it to return "Primary Name" if the Type row is "Type 1" and the "Secondary Name" if the Type row is "Type 2".

    So something like this:

    IF([Type]@row="Type1 ",[Primary Name]@row, [Secondary Name]@row)
    

    If you need to explicitly check for "Type 2" then you can nest an IF statement

    IF([Type]@row="Type1 ",[Primary Name]@row, IF([Type]@row="Type2", [Secondary Name]@row, "Type not found"))
    

    Hope this helps

    Tim

  • Deesa Dontamsetti
    Options

    Thank you all! Appreciate your help!!

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

    @Deesa Dontamsetti

    You're more than welcome!

    Please support the Community by marking the post(s) that helped or answered your question or solved your problem with the accepted answer/helpful. 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.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!