How do I use IF formula to change a colour based on a percentage column?
I have a status column with red, yellow and green. I'm needing a formula to change these colours when the percentage complete column gets below a certain percentage.
i.e. 1-50% Red
51%-99% Yellow
100% Green
Answers
-
jg124 ✭✭✭✭✭
Something like this should work. Enter this formula in your status symbol column:
=IF([%Complete]1=100, "Green", IF([%Complete]1 < 51, "Red", "Yellow"))
-
Paul Newcome ✭✭✭✭✭✭
@jg124Smartsheet reads percentages as decimals, so 100% = 1, 50% = 0.5, etc. Otherwise your formula looks good.
=IF([%Complete]@row = 1, "Green", IF([%Complete]@row < 0.51, "Red", "Yellow"))
-
@jg124thank you for posting -- clean formula.
Is it possible to modify to make it if X% and end date is <1 day, "RED"
For example, if it's within 1 day of a task being due but only 50% complete, make it RED.
-
Paul Newcome ✭✭✭✭✭✭
You would want to use something along the lines of...
=IF([%Complete]@row = 1, "Green", IF(AND([Due Date]@row<= TODAY(1),[%Complete]@row < 0.51), "Red", "Yellow"))
-
First, thank you so much for the modification. This is getting closer to what I'd like to do.
Any chance you could elaborate a little on the formula --- specifically, what does the value (1) represent next to Today? --
Also, trying to make it so that if the task is due within 3 days and less than 51% complete, then Red.
And would like to be able to manipulate the formula to say if it's 80% complete and same as above (within 3 days due), make it Yellow
-
Paul Newcome ✭✭✭✭✭✭
TODAY(1) is basically saying TODAY + 1 or tomorrow. So if the Due Date is less than tomorrow.
=IF([%Complete]@row = 1, "Green", IF(AND([Due Date]@row <= TODAY(1), [%Complete]@row < 0.51), "Red", "Yellow"))
The above says...
If the % Complete = 100%, Green.
If the Due Date is less than tomorrow AND the % Complete is less than 50%, Red.
Everything else gets Yellow.
We can set it for less than 80% and within 3 days to turn yellow, but you will need to fill in the bold portion with whatever you want for something that doesn't fit within the three specified criteria sets.
=IF([%Complete]@row = 1, "Green", IF(AND([Due Date]@row <= TODAY(1), [%Complete]@row < 0.51), "Red", IF(AND([Due Date]@row <= TODAY(), [%Complete]@row < 0.8), "Yellow", "if all are false")))
-
@Paul Newcome--- i modified a bit but getting Unparseable error -- also not certain if it's correct syntax to write Today - 3?
=IF([%Complete]@row = 1, "Blue", IF(AND([Due Date]@row <= TODAY-3, [%Complete]@row < 0.51), "Red", IF(AND([Due Date]@row <= TODAY-3, [%Complete]@row < 0.8), "Yellow", "Green")))
If task is marked 100% turn it Blue;
If task is <= 51% complete and it's within 3 days of End Date, turn it RED
If task is <= 80% complete and it's within 3 days of End Date, turn it YELLOW(will this be greater 51<>80%?)
If task is > 80% completeand <=Today, turn it Green
-
Paul Newcome ✭✭✭✭✭✭
To subtract from TODAY, you would use
TODAY(-3)
I am going to suggest using positive numbers inside of the TODAY function though. I have found that it helps (me) to think of dates as numbers where TODAY() = 0, Yesterday = (-1), and Tomorrow = 1.
[Due Date]@row <= TODAY(-3)
is basically saying the Due Date is three or more days in the past and not within the next 3 days. Does that make sense?
-
@Paul NewcomeYes! Ahh Thank you for explaining -- makes sense.
I modified it as below -- but still getting "unparseable" error -- any idea what is missing?
=IF([%Complete]@row = 1, "Blue", IF(AND([Due Date]@row <= TODAY(3), [%Complete]@row < 0.51), "Red", IF(AND([Due Date]@row <= TODAY(3), [%Complete]@row < 0.8), "Yellow", "Green")))
-
Paul Newcome ✭✭✭✭✭✭
I would start by double checking the column names. Is it [% Complete] or [%Complete]?
If that is not it, can you copy/paste the formula directly from the sheet exactly as it is?
-
Had double checked the column to ensure it was %Complete (no space) -- and pasted exactly what I pasted in the cell -- not sure if i have a syntax error?
Help :)
-
Paul Newcome ✭✭✭✭✭✭
Depending on your region, you may need to swap commas out for semicolons and periods out for commas.
=IF([%Complete]@row = 1; "Blue"; IF(AND([Due Date]@row <= TODAY(3); [%Complete]@row < 0,51); "Red"; IF(AND([Due Date]@row <= TODAY(3); [%Complete]@row < 0,8); "Yellow"; "Green")))
Does that work?
-
Wait!!! Due DATE -- it's titled End Date -- that may be it -- one sec will try
-
Paul Newcome ✭✭✭✭✭✭
That very well could be it. If you don't have a column on your sheet called [Due Date] then you will get that error.
-
=IF([%Complete]@row = 1, "Blue", IF(AND([Finish]@row <= TODAY(3), [%Complete]@row < 0, 51), "Red", IF(AND([Finish]@row <= TODAY(3), [%Complete]@row < 0, 8), "Yellow", "Green")))
Above is new formula -- getting an "Invalid Datatype" error :(
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":"