HAS with multiple criteria and qualifying checbox
I'm trying to pull data related to only 1 program and not another, then add in whether a check box is ticked. The first part of my formula works:
=COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP")))
But when I add the second part it becomes unparseable:
=COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP"))), ([External providers and advocacy groups]:[External providers and advocacy groups], 1))
How can I get this to work so I can see the checkboxes only from the criteria indicated in the initial column?
Best Answer
-
Hi @Lily DV
You have unnecessary parentheses. So, when I removed those, the formula worked.
Your formula
=COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP"))
),([External providers and advocacy groups]:[External providers and advocacy groups], 1))My formula
=COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP")), [External providers and advocacy groups]:[External providers and advocacy groups], 1)
In your formula, the COUNTIFS has OR() as a condition. But as you have an extra ")" , the formula considers COUNTIFS finish there.
Then, the COUNTIFS expect this structure, COUNTIFS(range1, condition1, range2, condition2). But, as you enclose " [External providers and advocacy groups]:[External providers and advocacy groups], 1)" in parentheses, the formula sees this structure, "COUNTIFS(range1, condition1, (range2, condition2))" and considers that you do not provide the condition2. ((range 2, condition2) becomes range2 with the parentheses.)
I am not sure what you mean by "ECSP & HCW". If you mean to select both ECSP and HCW in the multiple dropdown list, the formula should be the following.
=COUNTIFS(Program:Program, OR(AND(HAS(@cell, "ECSP"), HAS(@cell, "HCW")), HAS(@cell, "ECSP")), [External providers and advocacy groups]:[External providers and advocacy groups], 1)
The demo sheet below is editable, so please test how the formula works.
Answers
-
Hi @Lily DV
You have unnecessary parentheses. So, when I removed those, the formula worked.
Your formula
=COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP"))
),([External providers and advocacy groups]:[External providers and advocacy groups], 1))My formula
=COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP")), [External providers and advocacy groups]:[External providers and advocacy groups], 1)
In your formula, the COUNTIFS has OR() as a condition. But as you have an extra ")" , the formula considers COUNTIFS finish there.
Then, the COUNTIFS expect this structure, COUNTIFS(range1, condition1, range2, condition2). But, as you enclose " [External providers and advocacy groups]:[External providers and advocacy groups], 1)" in parentheses, the formula sees this structure, "COUNTIFS(range1, condition1, (range2, condition2))" and considers that you do not provide the condition2. ((range 2, condition2) becomes range2 with the parentheses.)
I am not sure what you mean by "ECSP & HCW". If you mean to select both ECSP and HCW in the multiple dropdown list, the formula should be the following.
=COUNTIFS(Program:Program, OR(AND(HAS(@cell, "ECSP"), HAS(@cell, "HCW")), HAS(@cell, "ECSP")), [External providers and advocacy groups]:[External providers and advocacy groups], 1)
The demo sheet below is editable, so please test how the formula works.
-
In the above scenario if you had a second multi-select column for instance State (where program was available) could you pull (countifs) 'Program' HAS "ECSP" and 'State' HAS "FL"?
-
Hi @PeggyLang
I added a helper column, the "Has FL" checkbox column, and used that as another condition of the COUNTIF function.
[Has FL] =IF(HAS(State@row, "FL"), 1, 0)
[Count State = FL 1] =COUNTIFS(Program:Program, OR(HAS(@cell, "ECSP & HCW"), HAS(@cell, "ECSP")), [External providers and advocacy groups]:[External providers and advocacy groups], 1, [Has FL]:[Has FL], 1)
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 140 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!