Count the number of times multiple values appear in a column
Hello SS Community,
I'm trying to count the number of instances two values appear together in a cell. From the following example, I would like to count how often "Contractor" and "Vendor" appear together, and furthermore I would like to sum the budget for those instances as well.
When I use the CountIf with Contains formula, it is giving me every instance the contractor appears in the column. Is there any way to achieve the given objective here?
Thank you,
Yogin
Best Answer
-
Hi Yogin,
Do you want to count instances where only Contractor and Vendor are together? Or when they're together, along with other potential options (such as the 4th row with content)? COUNTIF with CONTAINS could work if you add in AND to specify that both values need to be together in the cell:
=COUNTIF(Dept:Dept, AND(CONTAINS("Contractor", @cell), CONTAINS("Vendor", @cell)))
Your SUMIF formula would be similar, just adding in the Sum Range at the end:
=SUMIF(Dept:Dept, AND(CONTAINS("Contractor", @cell), CONTAINS("Vendor", @cell)), Budget:Budget)
Keep in mind that both of these would include the row that has Contractor, Vendor, and Admin as well, but it would exclude the row that only has one of either value.
Let me know if this would work for your purposes!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
Hi Yogin,
Try something like this.
=COUNTIFS(Dept:Dept; CONTAINS("Contractor"; @cell); Dept:Dept; CONTAINS("Vendor"; @cell))
The same version but with the below changes for your and others convenience.
=COUNTIFS(Dept:Dept, CONTAINS("Contractor", @cell), Dept:Dept, CONTAINS("Vendor", @cell))
Depending on your country you’ll need to exchange the comma to a period and the semi-colon to a comma.
Did it work?
I hope that helps!
Have a fantastic week!
Best,
Andrée Starå
Workflow Consultant / CEO @ WORK BOLD
✅Did my post help answer your question or solve your problem? Please help the Community by marking it as the accepted answer. It will make it easier for others to find a solution or help to answer!
SMARTSHEET EXPERT CONSULTANT & PARTNER
Andrée Starå | Workflow Consultant / CEO @ WORK BOLD
W: www.workbold.com | E:andree@workbold.com | P: +46 (0) - 72 - 510 99 35
Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.
-
Hi Yogin,
Do you want to count instances where only Contractor and Vendor are together? Or when they're together, along with other potential options (such as the 4th row with content)? COUNTIF with CONTAINS could work if you add in AND to specify that both values need to be together in the cell:
=COUNTIF(Dept:Dept, AND(CONTAINS("Contractor", @cell), CONTAINS("Vendor", @cell)))
Your SUMIF formula would be similar, just adding in the Sum Range at the end:
=SUMIF(Dept:Dept, AND(CONTAINS("Contractor", @cell), CONTAINS("Vendor", @cell)), Budget:Budget)
Keep in mind that both of these would include the row that has Contractor, Vendor, and Admin as well, but it would exclude the row that only has one of either value.
Let me know if this would work for your purposes!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Thank you both. And apologies for the time that has passed. The calculation idea was not needed anymore, but I still went ahead and checked. Though these formulas do provide some numbers, they're coming out more than what I can count on smartsheet (the formula reveals 17 instances where two values are together, and on the source sheet there are 14 instances)
Best,
Yogin
-
@Yogin Bhatti Ok. Thanks for the update!
Let us know if you want to look at it again.
SMARTSHEET EXPERT CONSULTANT & PARTNER
Andrée Starå | Workflow Consultant / CEO @ WORK BOLD
W: www.workbold.com | E:andree@workbold.com | P: +46 (0) - 72 - 510 99 35
Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!