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
- Smartsheet Customer Resources
- 64K Get Help
- 410 Global Discussions
- 220 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 137 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!