RYG based on Done Check box and Due Date

Options
Greg Roeder
Greg Roeder ✭✭
edited 12/09/19 in Formulas and Functions

I want to write a formula to turn ball red if done check box is unchecked and the date is  less then or equal to today minus 2, yellow if unchecked and the date is greater than today -3 and less then today -5, and green if done box is checked 

=IF(AND(Done7 = 0, [Due Date]7 <= TODAY(-2), "Red", IF([Due Date]7>TODAY(-2), "Yellow", if([Due Date]7>TODAY(-5)"Green")))

Tags:

Comments

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭
    Options

    Good start. You are going to have to repeat the AND statements and close them before each IF statement. You were also missing some crucial commas. Try this one... 

    =IF(AND(Done7 = 0, [Due Date]7 <= TODAY(-2)), "Red", IF(AND([Due Date]7>TODAY(-2), Done7-0), "Yellow", IF(AND([Due Date]7>TODAY(-5), Done7=0),"Green")))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    I personally would list the Green criteria first. That way you can remove the AND from each of the other colors' criteria.

     

    =IF(Done@row = 1, "Green", .......................................)))

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭
    Options

    There is some sense to that Paul. But he is placing Green health for objects that are not-done and still have 5 days left. Placing that at the beginning doesn't negate the need for the and in that particular case. However... if you went with RYG-gray... then you could do =IF(Done@row = 1, "Gray", then list out your additional criteria. 

     

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    Mike,

     

    I see that in the formula itself, but in the main body of the post, the last part is 

     

    "...and green if done box is checked"

     

    That's why I suggested the change that I did. I didn't take a whole lot of notice to the formula until you mentioned the difference.

    .

    Greg,

     

    Can you post the exact criteria for each color broken down in a sort of list similar to the below? That way we can figure out exactly what it is you are wanting to accomplish since there seems to be a discrepancy between the formula and your text?

     

    Green: This is what turns the ball green

    Yellow: This and this will turn the ball yellow

    Red: This or this will turn the ball red

     

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!