need help with RYG formula
Hi Smartsheeters',
Please help me to find a solution with my formula.
任务的本质是改变指标s in the Health column using a formula.
I need to:
if Status is In Progress and Due Date is less than Today
and if Status is Completed and % Complete is 100%, then GREEN
if Status is At Risk and Due date is less than Today
and if % Completion is Blank, then YELLOW
if % Completion is Blank and Start Date is greater than today
and if the Due Date is greater than today and the % Complete is less than 100%, then RED
The formula I'm currently using doesn't work. It's so long that I might have made a syntax error.
Is it possible to make it shorter?
=IF(OR([% Complete]@row = 1, [Due date]@row > = TODAY()), "Green", IF(Status@row = "In progress", "Green", IF(AND([Due date]@row > TODAY(), [% Complete]@row < 1), "Green", IF(Status@row = "Completed", "Green", IF(Status@row = "At risk", "Yellow", IF(AND([Due date]@row > TODAY(), [% Complete]@row < 1), "Yellow", IF(AND([Due date]@row > TODAY(), [% Complete]@row = 0), "Yellow", IF(Status@row = "At risk", "Red", IF(AND([Due date]@row > TODAY(), [% Complete]@row < 1), "Red", IF(Status@row = "Not started", "Red", IF(AND([Start date]@row < TODAY(), [% Complete]@row = 0), "Red", IF([% Complete]@row < 0.75, "Yellow", IF(AND([Due date]@row = TODAY(7), [% Complete]@row < 0.25), "Red", IF([% Complete]@row < 0.5, "Yellow", "Green"))))))))
Thanks in advance and will greatly appreciate your help,
Carol
Best Answer
-
Aravind GP ✭✭
Hi Carol,
这个公式从左到右。所以如果你佤邦nt Red to take priority, add that prior to condition #4 and make condition #4 as the last IF statement. If you still have issues, email me and we can arrange for a screen sharing session to make it easier.
Thanks,
Aravind
Associate Director
Copernicus Consulting Pte. Ltd.
P: +65 9230 5657 | E:[email protected]
Feel free to reach out for licenses, services, and training on Smartsheet
Answers
-
Aravind GP ✭✭
Hi Carol,
Based on the conditions you have specified, I have given the formula below. However, I would suggest that you have a max of 2 conditions for each RYG color to make it simpler.
=IF(AND(Status@row = "In Progress", [Due Date]@row < TODAY()), "Green", IF(AND(Status@row = "Complete", [% Complete]@row = 1), "Green", IF(AND(Status@row = "At Risk", [Due Date]@row < TODAY()), "Yellow", IF(ISBLANK([% Complete]@row), "Yellow", IF(AND(ISBLANK([% Complete]@row), [Start Date]@row > TODAY()), "Red", IF(AND([Due Date]@row > TODAY(), [% Complete]@row < 1), "Red"))))))
Thanks,
Aravind
Associate Director
Copernicus Consulting Pte. Ltd.
P: +65 9230 5657 | E:[email protected]
Feel free to reach out for licenses, services, and training on Smartsheet
-
Hi Aravind,
Thanks for the answer, but the formula still doesn't work as expected.
So what I'm saying - if the % Complete cell is Empty, then the Health colour should change accordingly.
Now the formula works the other way around - if the Status is At Risk and the % Complete is 10%, then the Health cell becomes Empty.
Also, binding to dates is very important, which is probably why I got such a long formula
To demonstrate what I mean - please see attached file. 4 highlighted rows show different statuses.
Thanks,
Carol
-
Aravind GP ✭✭
Hi Carol,
I realized that there was an error in the formula. It says "Complete" instead of "Completed" as in your sheet. Fixing that will fix the error in row# 7.
For Row# 8, the formula of % Complete being blank is taking it as Yellow. What color are you expecting it to be?
Row# 9 is taking the formula Due date being greater than today and % Complete being less than 100%. What color are you expecting it to be?
Row# 10 is blank as I didn't include a formula for "Not Started". Since it was not a condition as per the explanation in your "I need to:"
Thanks,
Aravind
Associate Director
Copernicus Consulting Pte. Ltd.
P: +65 9230 5657 | E:[email protected]
Feel free to reach out for licenses, services, and training on Smartsheet
-
Hi Aravind,
You're right about Complete and Completed - this part is working now.
And I'm sorry about Not started status, forgot to add this condition to my initial question.
I need to:
if Status is In Progress and Due Date is less than Today
and if Status is Completed and % Complete is 100%, then GREEN
if Status is At Risk and Due date is less than Today
and if % Completion is Blank, then YELLOW
if % Completion is Blank and Start Date is greater than today
if Status is Not started or Blank
and if the Due Date is greater than today and the % Complete is less than 100%, then RED
Thanks again,
Carol
-
Aravind GP ✭✭
Hi Carol,
Here's the new formula.
=IF(AND(Status@row = "In Progress", [Due Date]@row < TODAY()), "Green", IF(AND(Status@row = "Completed", [% Complete]@row = 1), "Green", IF(AND(Status@row = "At Risk", [Due Date]@row < TODAY()), "Yellow", IF(ISBLANK([% Complete]@row), "Yellow", IF(AND(ISBLANK([% Complete]@row), [Start Date]@row > TODAY()), "Red", IF(OR(Status@row = "Not Started", ISBLANK(Status@row)), "Red", IF(AND([Due Date]@row > TODAY(), [% Complete]@row < 1), "Red")))))))
It works like this:
- If the status is "In Progress"ANDthe Due Date is less than today (i.e. in the past), then green
- If the status is "Completed"ANDthe % Complete is 100%, then green
- If the status is "At Risk"ANDthe Due Date is less than today (i.e. in the past), then Yellow
- If the % Complete is blank, then yellow
- If the % Complete is blankANDthe Start Date is greater than today (i.e. in the future), then red
- If the Status is "Not Started"ORis blank, then red
- If the Due Date is greater than today (i.e. in the future)ANDthe % Complete is less than 100%, then red
Ideally, I would work it the other way around, where if the due date is in the past and it is not 100% complete, then red and if the start date is in the future, then green.
Thanks,
Aravind
Associate Director
Copernicus Consulting Pte. Ltd.
P: +65 9230 5657 | E:[email protected]
Feel free to reach out for licenses, services, and training on Smartsheet
-
Hi Aravind,
You're absolutely right :) I worked so hard yesterday and I got confused.
This is current formula
=IF(AND(Status@row = "In Progress", [Due date]@row > TODAY()), "Green", IF(AND(Status@row = "Completed", [% Complete]@row = 1), "Green", IF(AND(Status@row = "At Risk", [Due date]@row < TODAY()), "Yellow", IF(ISBLANK([% Complete]@row), "Yellow", IF(AND(ISBLANK([% Complete]@row), [Start date]@row > TODAY()), "Red", IF(OR(Status@row = "Not Started", [Start date]@row < TODAY(), ISBLANK([% Complete]@row)), "Red", IF(AND([Due date]@row > TODAY(), [% Complete]@row < 1, ISBLANK([% Complete]@row)), "Red")))))))
I changed conditions to:
1. If the status is "In Progress" AND the Due Date is greater than today (i.e. in the future), then green
2. If the status is "Completed" AND the % Complete is 100%, then green
3. If the status is "At Risk" AND the Due Date is less than today (i.e. in the past), then Yellow
4. If the % Complete is blank, then yellow
5. If the % Complete is blank AND the Start Date is less than today (i.e. in the past), then red
6. If the Status is "Not Started" OR is blank, then red
7. If the Due Date is less than today (i.e. in the past) AND the % Complete is less than 100%, then red
8. If the Status is "Not Started" and the Start Date is less than today (i.e. in the past), AND if the "% Complete" is blank, then RED
The formula works, but the condition #8 just changes the ball colour to YELLOW. I think it happens because of #4
It turns out that filling in "% Completion" has a higher priority than "Start Date" and "Due Date" dependencies, but the priorities should be the same. I don’t know how to fix it (rows 10 and 11 in attached file)
I would be grateful for your help
Thanks in advance,
Carol
-
Aravind GP ✭✭
Hi Carol,
这个公式从左到右。所以如果你佤邦nt Red to take priority, add that prior to condition #4 and make condition #4 as the last IF statement. If you still have issues, email me and we can arrange for a screen sharing session to make it easier.
Thanks,
Aravind
Associate Director
Copernicus Consulting Pte. Ltd.
P: +65 9230 5657 | E:[email protected]
Feel free to reach out for licenses, services, and training on Smartsheet
-
Hi Aravind,
Thanks a lot for your help.
Now everything works, I swapped operators in the formula.
Have a great week,
Carol
Help Article Resources
Categories
Check out theFormula Handbook template!
Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>
=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>
Thank you,<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":109493,"type":"question","name":"I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","excerpt":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5 different statuses in a separate column. So using the screenshot I've provided as an example (although it doesn't have 5 different statuses in the…","snippet":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5…","categoryID":322,"dateInserted":"2023-08-25T20:03:21+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:34:49+00:00","insertUserID":165710,"insertUser":{"userID":165710,"name":"SmarsheetNewb","url":"https:\/\/community.smartsheet.com\/profile\/SmarsheetNewb","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:33:27+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":22,"score":null,"hot":3386005690,"url":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109493,"commentID":392692,"name":"Re: I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392692#Comment_392692","dateInserted":"2023-08-26T00:34:49+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:33:25+00:00","dateAnswered":"2023-08-25T20:44:12+00:00","acceptedAnswers":[{"commentID":392662,"body":"
Try this:<\/p>
=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"