Simple COUNTIF with OR

Options
Arundhati
Arundhati ✭✭✭
edited 10/26/23 in Formulas and Functions

Here is what I am trying to set up:

Count the no. of cells in Column A where condition X or condition Y is true. How do I write this in a formula?

Answers

  • Nic Larsen
    Nic Larsen ✭✭✭✭✭✭
    Options

    More info is likely needed, but it would be something like this:

    =COUNTIFS([Column A]:[Column A], OR(@cell = "Condition x", @cell = "Condition Y"))

  • Arundhati
    Arundhati ✭✭✭
    edited 10/26/23
    Options


    What would @cell be?


    If this is my data set, I want the "Apples" sheet summary field to count where "Apple" or "Apple, Orange" is true

    Similarly, I want I want the "Orange" sheet summary field to count where "Orange " or "Apple, Orange" is true

  • Nic Larsen
    Nic Larsen ✭✭✭✭✭✭
    edited 10/26/23
    Options

    @Arundhati

    @cell & @row are useful functions in Smartsheet to create more efficient formulas. More info here: Create efficient formulas with @cell and @row | Smartsheet Learning Center.

    I would use a formula like this for the above scenario:

    =COUNTIFS([Column A]:[Column A], OR(CONTAINS("Apple", @cell), CONTAINS("Orange", @cell)))

    After I thought on it more, you probably need it like this:

    Apples: =COUNTIFS([Column A]:[Column A], FIND("Apple", @cell) >= 1)

    Oranges: =COUNTIFS([Column A]:[Column A], FIND("Orange", @cell) >= 1)

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!