Formulas and Functions

Formulas and Functions

Ask for help with your formula and find examples of how others use formulas and functions to solve a similar problem.

Countifs to Consider More than one drop down in one range of data

Example I currently have that is only considering one in the range =COUNTIFS({Site Wide SOC's 2024 Range 2}, "Plant Maintenance", {Site Wide SOC's 2024 Range 1}, "USA")

What I would like to see is that it consider "Plant Operations" in the same way it considers Plant Maintenance. =COUNTIFS({Site Wide SOC's 2024 Range 2}, "Plant Maintenance", {Site Wide SOC's 2024 Range 2}, "Plant Operations", {Site Wide SOC's 2024 Range 1}, "HI")

However it seems this formula will only count it if it is both Plant Maintenance and Plant Operations. I want the formula to consider if range 2 is either Plant Maintenance or Plant Operations, not both. Is there is a way to lump these together?

Essentially we want to count all the "HI"'s in range 1 if range 2 is either of "Plant Maintenance" or "Plant Operations"

Best Answer

  • Community Champion
    Answer ✓

    Hi @Brianne,

    You can get round this by introducing some OR & CONTAINS:

    =COUNTIFS({Site Wide SOC's 2024 Range 2}:{Site Wide SOC's 2024 Range 2}, OR(CONTAINS("Plant Maintenance", @cell), CONTAINS("Plant Operations", @cell)), {Site Wide SOC's 2024 Range 1}:{Site Wide SOC's 2024 Range 1}, "HI") - COUNTIFS({Site Wide SOC's 2024 Range 2}:{Site Wide SOC's 2024 Range 2}, AND(CONTAINS("Plant Maintenance", @cell), CONTAINS("Plant Operations", @cell)), {Site Wide SOC's 2024 Range 1}:{Site Wide SOC's 2024 Range 1}, "HI")

    Example of this (using same sheet column references instead of ranges):

    If you wanted the rows with both included in, you simply trim the formula down to remove the COUNTIFS with both subtraction:

    =COUNTIFS([SOC Range 2]:[SOC Range 2], OR(CONTAINS("Plant Maintenance", @cell), CONTAINS("Plant Operations", @cell)), [SOC Range 1]:[SOC Range 1], "HI")

    In the above example, this would increase the result to 4 (row 1 would be counted).

    Hope this helps, but if I've misunderstood anything or you still have any problems/questions then just let us know!

Answers

  • Community Champion

    @Brianne

    This is where the OR function can be used:

    =COUNTIFS({Site Wide SOC's 2024 Range 2}, OR(@cell="Plant Maintenance", @cell="Plant Operations"), {Site Wide SOC's 2024 Range 1}, "HI")

  • Community Champion
    Answer ✓

    Hi @Brianne,

    You can get round this by introducing some OR & CONTAINS:

    =COUNTIFS({Site Wide SOC's 2024 Range 2}:{Site Wide SOC's 2024 Range 2}, OR(CONTAINS("Plant Maintenance", @cell), CONTAINS("Plant Operations", @cell)), {Site Wide SOC's 2024 Range 1}:{Site Wide SOC's 2024 Range 1}, "HI") - COUNTIFS({Site Wide SOC's 2024 Range 2}:{Site Wide SOC's 2024 Range 2}, AND(CONTAINS("Plant Maintenance", @cell), CONTAINS("Plant Operations", @cell)), {Site Wide SOC's 2024 Range 1}:{Site Wide SOC's 2024 Range 1}, "HI")

    Example of this (using same sheet column references instead of ranges):

    If you wanted the rows with both included in, you simply trim the formula down to remove the COUNTIFS with both subtraction:

    =COUNTIFS([SOC Range 2]:[SOC Range 2], OR(CONTAINS("Plant Maintenance", @cell), CONTAINS("Plant Operations", @cell)), [SOC Range 1]:[SOC Range 1], "HI")

    In the above example, this would increase the result to 4 (row 1 would be counted).

    Hope this helps, but if I've misunderstood anything or you still have any problems/questions then just let us know!

  • ✭✭

    Hi Nick, Thank you for getting back to me so quick. You have solved the biggest headache I have had all week! :)

    This worked out great, all I had to do was change it to be a cross sheet reference and it seems to be working great. I sincerely appreciate your help!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!

Trending in Formulas and Functions

  • I'm trying to create a SUMIF formula that looks at the salesperson name in a column and adds up or totals their $ sales in another column. To ultimately show in Dashboard of Totals Sales by Salesperso…
    User: "Allan Z"
    Answered ✓
    8
    2
  • Good day Smartsheet Team, Getting an unparseable error on this formula: =IF($Name@row <> "",(SUMIFS({Expense}, {Period},1, {Type}, OR(@cell = "RES602782", @cell = "RES602497")),"") Trying to pull in a…
    User: "stratman"
    Answered ✓
    15
    2
  • I have a sheet that compiles all the responses from a form. The sheet has multiple start and end date columns, but only one start and one end date cell is NOT blank depending on the activity selected …
    User: "m_anderson"
    Answered ✓
    13
    2