Contains with Multi-select column
I have a column that is multi-select for our systems. The values in this column are X, Xi, S, SP and a few others. I am trying to count the number of rows where the value "X" is selected. Sometimes it may be only X, other times the column value may have both X and Xi. When i use contains, it is counting everything in the string, so it includes all the instances of Xi as well as X.
I've tried multiple approaches, but am stuck. Any help would be most appreciated. This was the original formula I tried.
=COUNTIF({Platform}, CONTAINS("X", @cell))
Best Answer
-
This was tricky. Try this =COUNTIF({Platform}, IF(HAS(@cell, "X"), "true", "false") = "true")
This is essentially counting each cell and marking it as true if it contains exactly an "X"
Answers
-
Hi Lynn
Try HAS instead of CONTAINS. HAS is an exact match function. Note the syntax is different.
=COUNTIF({Platform}, HAS(@cell, "X"))
-
This was tricky. Try this =COUNTIF({Platform}, IF(HAS(@cell, "X"), "true", "false") = "true")
This is essentially counting each cell and marking it as true if it contains exactly an "X"
-
Thank you so much for this suggestion. I had tried HAS, but Mike's answer below was spot on. Really appreciate you reviewing my question and reaching out!
-
Instead of using CONTAINS, try OR(@cell = "X", @cell = "Xi")
=COUNTIF({Platform}, OR(@cell = "X", @cell = "Xi"))
-
thanks for responding, this was not quite what i needed, but Mike answered the question and that formula worked!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.3K Get Help
- 422 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 143 Just for fun
- 59 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!