Average Health (RYG) Column Formula

Options

Hello!

I am working on a column formula (Column Type: Symbol, Symbol Value: RYG light) for a project plan sheet that will calculate task health based on a number of factors. The goal is to use this column formula in place of user intervention and to streamline health calculation across all projects based on set criteria. The formula is as follows:

=IF(COUNT(CHILDREN([Task Name]@row)) > 0, IF(COUNT(CHILDREN([Task Name]@row)) <> COUNTIFS(CHILDREN(), ISBLANK(@cell)), IF(OR(COUNTIF(CHILDREN(), "Red") > COUNTIF(CHILDREN(), "Yellow"), COUNTIF(CHILDREN(), "Red") > COUNTIF(CHILDREN(), "Green")), "Red", IF(COUNTIF(CHILDREN(), "Red") > 0, "Yellow", IF(OR(COUNTIF(CHILDREN(), "Green") > COUNTIF(CHILDREN(), "Red"), COUNTIF(CHILDREN(), "Green") > COUNTIF(CHILDREN(), "Yellow")), "Green", "Yellow")))), IF(ISBLANK([End Date]@row), "", IF(Status@row = "Complete", "Green", IF([End Date]@row < TODAY(), "Red", IF([At Risk]@row = 1, "Yellow", IF([End Date]@row > TODAY(), "Green", IF(OR([End Date]@row = TODAY(), [End Date]@row = TODAY(1)), "Yellow")))))))

It is designed to first check if the row is a parent row and calculate an "average" health based on its children. This allows us to add multiple hierarchies without having to worry about creating separate formulas for parent and child rows. If the row is not a parent row, the health is calculated based on date, task status, and risk status.

This formula has generally been successful, but I am running into a few issues with parent task health. There are two examples where I think the health is calculating incorrectly. I am unable to determine why. Below is a screenshot with examples of where I think the health is calculating incorrectly (see rows "Phase 3" and "Phase 4"); in both cases, I'm expecting the health to be yellow.

image.png

Phase 3: I'm expecting this to be yellow. I would assume this hits the IF(COUNTIF(CHILDREN(), "Red") > 0, "Yellow" condition because it does not meet the criteria of "Count Red Children > Yellow Children or Count Red Children > Green Children".

Phase 4: I'm expecting this to be yellow. I thought this would hit the "Otherwise Yellow" criteria in the IF(OR(COUNTIF(CHILDREN(), "Green") > COUNTIF(CHILDREN(), "Red"), COUNTIF(CHILDREN(), "Green") > COUNTIF(CHILDREN(), "Yellow")), "Green", "Yellow" condition. I don't see where this would meet any of the previous criteria.

Any insight would be greatly appreciated.

Best Answer

  • Paul Newcome
    Paul Newcome Community Champion
    Answer ✓

    My apologies for not finishing out my last post. I am working with another user in another post where we are discussing the same exact logic.


    I use if there is at least one red then red, if there is at least one yellow, then yellow, otherwise green. The only time it will ever show green on a parent row is if ALL child rows are green.

    =IF(COUNTIFS(CHILDREN(), "Red")> 0, "Red", IF(COUNTIFS(CHILDREN(), "Yellow")> 0, "Yellow", "Green"))


    In response to your other quick question at the bottom of your last comment... Yes. Your IF/OR combo will account for that very specific scenario, but what about 3 green, 4 yellow, and 3 red? I would still want Red on my parent row so that I can see that I have children that are red, but the IF/OR wouldn't flag as true to output a red.


    Or maybe 11 tasks. 1 green, 5 yellow, and 5 red. I feel like being able to flag that parent row as red would be pretty important since there are so many reds, but the IF/OR wouldn't catch that either.

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!