HAS with multiple criteria and qualifying checbox

Options

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

  • jmyzk_cloudsmart_jp
    jmyzk_cloudsmart_jp ✭✭✭✭✭✭
    edited 01/15/24 Answer ✓
    Options

    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

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!