If AND or OR formula

Hi Experts,

I would like to extend my formula in column Tech Pack confirmed on time. It works well with the color balls.

=IF([Dev sample needed?]@row = "", "not needed", IF(AND([CAD upload on time ?]@row = "Green", [Pattern confirmed on time?]@row = "Green", [Tooling confirmed on time?]@row = "Green", [Materials confirmed on time?]@row = "Green"), "Green", IF(OR([CAD upload on time ?]@row = "Yellow", [Pattern confirmed on time?]@row = "Yellow", [Tooling confirmed on time?]@row = "Yellow", [Materials confirmed on time?]@row = "Yellow"), "Yellow", "Red")))

But now I need to add, if "not needed" is in the other columns it should be counted as "Green" or should not be counted.

E.g. the result in the 2nd and 3rd row should be "Green" and not red.

Thanks in advanced!

image.png


Tags:

Best Answer

  • Paul Newcome
    Paul Newcome Community Champion
    Answer βœ“

    It depends on what exactly your priorities are. The formula will read from left to right and stop at the first true value. If you want yellows to take priority over not needed, then the yellow IF should come before the not needed IF.


    My suggestion would be to write out how you want the formula to function keeping in mind priorities and how nested IFs work (if it makes it to the 3rd IF then the first two must be false).


    If this column is blank --> Not Needed

    If all columns are Green --> Green

    If any are Red --> Red

    If any are Yellow --> Yellow

    If the first column is not blank and there are no reds, yellows, or greens (meaning all is false) --> Not Needed


    Put your IF statements in this order as well

    IF([Column Name]@row = "", "Not Needed", <<>>)

    IF(AND(all_columns_green), "Green", <<>>)

    IF(OR(any_columns_red), "Red", <<>>)

    IF(OR(any_columns_yellow), "Yellow", <<>>)

    "Not Needed"


    Of course you may need to adjust the orders to fit your preferred priority, but this exercise will help you get everything laid out the way you need it to be.


    Now work from the bottom up. Put the "Not Needed" in place of the <<>> in the 4th IF. Take what you now have and put it in place of the <<>> in the 3rd IF. Take that new string and drop it in place of the <<>> in the 2nd IF. Take all of this now and drop it in place of the <<>> in the 1st IF.


    Throw an = on the front of this final string and you should have your working formula.

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!