Contains Formula
Hello, I am trying to make a CountIfs formula that counts across a different spreadsheet, on if the comments cell contains the words "Moved", "Delayed", "Rescheduled", "Canceled", then output the number of these delayed cells.
Having some trouble getting this to work as I think an OR statement is nested somewhere in here.
=COUNTIFS(AND({Domain}, [Domain & Area]@row, OR(CONTAINS("Canceled", {Comments}) CONTAINS("Delayed", {Comments}), CONTAINS("Moved", {Comments}), CONTAINS("Rescheduled", {Comments}))))
Thanks!
Answers
-
@RingJake I'm assuming you are referring to a column called "Comments" and not trying to search the Smartsheet comments/conversations on a row, right?
My initial thoughts: You're missing a comma (where the red circle is.) You also don't really need the AND because COUNTIFS will only count what matches all the conditions; AND is basically built in. You only really need AND to specify multiple logical statements for an IF, or to use to group criteria inside an OR.
So your logic can say:
Count if the Domain column or [Domain & Area] from this row, and also matches at least one of the criteria from within this OR statement.
=COUNTIFS({Domain}, [Domain & Area]@row, OR(CONTAINS("Canceled", {Comments}), CONTAINS("Delayed", {Comments}), CONTAINS("Moved", {Comments}), CONTAINS("Rescheduled", {Comments})))
(As always, make sure the first open parentheses color matches the last end parentheses color.)
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!
-
Thanks Jeff, and you are correct where Domain is from another sheet. This makes a little more sense - however the cell is outputting "Incorrect Output". Any other suggestions?
-
That's very odd. "Incorrect Output" is not even listed as a formula error message in Smartsheet.
Your {Domain} and {Comments} ranges are in the same remote sheet, correct?
Your {Comments} column - what is the column type (text/Number, dropdown, multi-select dropdown?)
Can you share a screenshot of your data structure and the error message?
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 Reisman We keep bumping into each other today. Haha.
"Incorrect Output" is definitely something I have never seen before. I am leaning towards maybe it is more of an "Incorrect Argument Set" type of issue because the syntax looks a little off. We don't have range, criteria, range, criteria going. This should work:
=COUNTIFS({Domain}, [Domain & Area]@row, {Comments}, OR(CONTAINS("Canceled", @cell), CONTAINS("Delayed", @cell), CONTAINS("Moved", @cell), CONTAINS("Rescheduled", @cell)))
-
@Paul Newcome Yep
I'm also trying to determine if CONTAINS is even necessary here. If the comments cells just contain one word to match, or if it's a multi-select select, something different might work better.
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!
-
Hi Jeff,
Thank you for the quick replies here - as requested please find two screenshots of my data structure.
-
Update your Chrome (out-of-date Chrome can many times cause Smartsheet issues) and then try Paul's version of your formula.
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!
-
Thanks @Jeff Reisman & @Paul Newcome, I've updated my Chrome and rebooted my computer as well. When inputting Paul's formula I am getting "Incorrect Argument". CONTAINS and OR statements are always a bit tricky.
-
Incorrect Argument Set means there's either an issue with the range sizes (ex. selecting an entire column for one range in the formula, and selecting a subset of rows for another range,) or with missing an argument in a function.
Make sure your {Domain} range and {Comments} range both are referencing the entire columns, or the same subset of rows in their columns. Double-check that parentheses color-coding in the formula matches up as well.
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!
-
Ah, that was it - thank you guys and have a great weekend!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!