Using COUNTIF and OR functions to match a value within a range of cells

I have a Status column with around 10 values (A-J). I would like to count the rows where status value = A, B, or C.

I've been able to do this via an OR function in which I explicitly list the values sought after (e.g. =COUNTIF({Status}, OR(@cell = "A", @cell = "B", @cell = "C")). But this can get quite lengthy if I'm adding up several values, like 7 of the 10.

Is there a way to ask it to look at a helper column range in a separate sheet, in which I list the values I want to total and add it up that way? e.g. Count the rows that match Status values in {Helper Column}1:{Helper Column}7

Tags:

Answers

  • Malaina Hudson
    Malaina Hudson ✭✭✭✭✭

    @Guaca Mohle ,

    You can do this pretty easily using only COUNTIF without the OR conditional. Here's how:

    • In your summary sheet, make 2 columns - the first is your status check (A-J), the second will be your summary counts.

    • In your count cell, use this formula to summarize your data

    =COUNTIF({test2 status range}, status@row)

    where test2 status range is the range of measurement on your original sheet (just select the whole column and I always rename ranges so i know what they are), and where status@row is the reference into the comparison data.


    Give that a try and let me know how it works for you.

  • Guaca Mohle
    Guaca Mohle ✭✭✭✭

    thank you. What I didn't tell you is that I'm actually using a COUNTIFS expression because Status is only one of the criteria that I'm trying to add up. I'm trying to shorten/simplify the formula below by hoping to reference a range in which the status values of interest are listed without having to list them all individually:

    =COUNTIFS({Status}, OR(@cell = $[Intake Breakdown]$4, @cell = $[Intake Breakdown]$5, @cell = $[Intake Breakdown]$6, @cell = $[Intake Breakdown]$8, @cell = $[Intake Breakdown]$10, @cell = $[Intake Breakdown]$11, @cell = $[Intake Breakdown]$12, @cell = $[Intake Breakdown]$13), {Requesting Team}, [Technical Services]$1, {Approval FY}, "FY22")


    P.S. NOT won't help as much because it turns out the list of possible values is actually 14 and so a NOT expression would be just as onerous.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!