Using COUNTIF and OR Function
i am currently using the following formula to control a parent reporting "Ready" or "Not Ready":
=IF(COUNT(CHILDREN()) = COUNTIF(CHILDREN(), "COMPLETE"), "COMPLETE", "Not Ready")
I would like to add an "OR" function to this to allow both "COMPLETE" and "NOT REQUIRED" to trigger the parent "Ready". Can you help me understand how to insert the "OR" function, i dont understand how the syntax needs to work for this... Thanks!
Best Regards,
Troy
Best Answer
-
Probably the least complicated syntax-wise would be to use two completely separate equations in the first part of the IF:
=IF(OR(COUNT(CHILDREN()) = COUNTIF(CHILDREN(), "COMPLETE"), COUNT(CHILDREN()) = COUNTIF(CHILDREN(), "NOT REQUIRED")), "COMPLETE", "Not Ready")
With this syntax you're saying IF either of these two equations is true, then set the value of "COMPLETE", otherwise set the value of "Not Ready".
HOWEVER - what I think you really want to do from a logical standpoint is to add the Count of Child rows showing COMPLETE to the count of Child rows showing NOT REQUIRED, and check if that equals the count of all child rows. In that case you don't need an OR:
=IF(COUNT(CHILDREN()) = (COUNTIF(CHILDREN(), "COMPLETE") + COUNTIF(CHILDREN(), "NOT REQUIRED")), "COMPLETE", "Not Ready")
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
Answers
-
Probably the least complicated syntax-wise would be to use two completely separate equations in the first part of the IF:
=IF(OR(COUNT(CHILDREN()) = COUNTIF(CHILDREN(), "COMPLETE"), COUNT(CHILDREN()) = COUNTIF(CHILDREN(), "NOT REQUIRED")), "COMPLETE", "Not Ready")
With this syntax you're saying IF either of these two equations is true, then set the value of "COMPLETE", otherwise set the value of "Not Ready".
HOWEVER - what I think you really want to do from a logical standpoint is to add the Count of Child rows showing COMPLETE to the count of Child rows showing NOT REQUIRED, and check if that equals the count of all child rows. In that case you don't need an OR:
=IF(COUNT(CHILDREN()) = (COUNTIF(CHILDREN(), "COMPLETE") + COUNTIF(CHILDREN(), "NOT REQUIRED")), "COMPLETE", "Not Ready")
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
-
Jeff,
Thank you so much for the response, and in fact both cases are true. Your first response is perfect for my current problem, however i have another application for the comparison equation you provided!
thank you again for crushing it @Jeff Reisman
-
Glad it worked for you. Have a great day.
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!