Nested IF statements counting Children color status
Hey community,
I've found simpler versions of this in the messages, but can't get this one correct.
The logic I'd like to express is:
- If any children under Flag show a Red, then the parent cell (Flag1) is Red
- If children Yellows are >= Green children, then the parent cell is Yellow
- Green otherwise.
The code I have is:
=IF(COUNTIFS(CHILDREN(), "Red") > 0, "Red",
IF(AND(COUNTIFS(CHILDREN(), "Yellow" >= COUNTIFS(CHILDREN(), "Green"), "YELLOW",
"Green"))))
Getting "Incorrect Argument". Help? Thanks, Paul
Best Answer
-
Hey @Paul Watts
The formula just needs a small adjustment. The Countifs for the Yellow is not closed off before making the comparison to the Countifs for Green.
=IF(COUNTIFS(CHILDREN(), "Red") > 0, "Red", IF(COUNTIFS(CHILDREN(), "Yellow") >= COUNTIFS(CHILDREN(), "Green"), "Yellow", "Green"))
cheers
Kelly
Answers
-
Hey @Paul Watts
The formula just needs a small adjustment. The Countifs for the Yellow is not closed off before making the comparison to the Countifs for Green.
=IF(COUNTIFS(CHILDREN(), "Red") > 0, "Red", IF(COUNTIFS(CHILDREN(), "Yellow") >= COUNTIFS(CHILDREN(), "Green"), "Yellow", "Green"))
cheers
Kelly
-
Thank you Kelly!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.3K Get Help
- 364 Global Discussions
- 199 Industry Talk
- 428 Announcements
- 4.4K Ideas & Feature Requests
- 136 Brandfolder
- 127 Just for fun
- 128 Community Job Board
- 445 Show & Tell
- 28 Member Spotlight
- 1 SmartStories
- 283 Events
- 35 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!