IF OR AND Statement

David Leon
edited 02/14/20 in Formulas and Functions

I am trying to return color symbols for in a sheet.

End goal

Date Null, Completed Null, or Past DATE(2020, 3, 31) = "Red"

Date is Not "Yes" and Not Past DATE(2020, 3, 31) = "Yellow"

Else = "Green"

Here is the code

=IF([Date Completed]1 > 0,IF(AND(NOT(Completed1 = "Yes"),[Date Completed]1 > DATE(2020, 3, 31)),"Red",IF(AND(NOT(Completed1 = "Yes"),[Date Completed]1 <= DATE(2020, 3, 21)), "Yellow","Green")), "Red")


Answers

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi David,

    It looks like you're just missing the OR statement at the beginning for your first instruction where the Date Completed is "null". I've removed out the "Red" instruction at the end of your formula, as well, since that will be included in the OR statement.

    Try This:

    =IF(OR(ISBLANK([Date Completed]@row), AND(NOT(Completed@row = "Yes"), [Date Completed]@row > DATE(2020, 3, 31))), "Red", IF(AND(NOT(Completed@row = "Yes"), [Date Completed]@row <= DATE(2020, 3, 21)), "Yellow", "Green"))


    I've also adjusted your 0 to be ISBLANK instead, unless you actually are entering 0's into your Date Completed column. You'll notice I prefer to use the @row function instead of referencing the row number, as well.

    Here are some Help Articles I used to write this - let me know if you have any questions: OR Function / ISBLANK Function

    Cheers!

    Genevieve

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!