Counting Children with different results creating different value if true values

I'm using this formula:

=IF(COUNT(CHILDREN([PROJECT ID]@row)) > 0, IF(COUNTIFS(CHILDREN([Task Completed]@row), 1) = COUNT(CHILDREN([PROJECT ID]@row)), "Complete"))

And it's working the way I need it to for the "Complete" status, as it's comparing the number of child rows to the number of times the "Task Completed" column checkbox is ticked and if they match then I'll get a "Complete" status in the box. I'm wondering if there's a way to write another portion in the same function that if the number of child rows counted in this part "IF(COUNTIFS(CHILDREN([Task Completed]@row), 1)" could equal the total count of child rows MINUS 2. The way the sheet is set up, there are a number of subtask child rows under each parent project row, but the last two child subtasks are the "closing" tasks, and the user wants different statuses for when the first 11 subtasks are completed (="In Closing") and when the last two tasks are checked off (="Complete"). Is this possible?

Another note - the Status column and the checkbox columns are separate columns.

Best Answer

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Try something like this:

    =IF(COUNT(CHILDREN([PROJECT ID]@row)) > 0, IF(COUNTIFS(CHILDREN([Task Completed]@row), 1) = COUNT(CHILDREN([PROJECT ID]@row)), "Complete", IF(COUNTIFS(CHILDREN([Task Completed]@row), 1) = COUNT(CHILDREN([PROJECT ID]@row)) - 2, "In Closing")))

    Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!

    CERTIFIED SMARTSHEET PLATINUM PARTNER

    10xViz.com

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!