CONTAINS not identifying all the instances

I wonder if someone could let me know where I'm going wrong here?

I want to know the number of instances where 'Treatment' is found in a column where

Person is Cell 32 in the Primary Column

Country is equal to Country$1

Start date is >=[Start Date]$2

End date is <=[End Date]$3

The formula I have come up with is:

=COUNTIFS({Person}, [Primary Column]$32, {Country}, Country$1, {Start Date}, >=[Start Date]$2, {End Date}, <=[End Date]$3, {Hospital}, CONTAINS("Treatment"))

The result it's giving me is 7, but it should be 36

Best Answer

  • Brian_Richardson
    Brian_Richardson Overachievers Alumni
    edited 05/30/24 Answer ✓

    Since you're trying to count for combinations of specific people and specific Treatment Plans, I would setup a sheet to do that analysis.

    Setup a sheet that has a column for the Person Interacted With, Country, Start/End dates (date columns), and a column for each of the Treatment Plan options.

    Then setup column formulas for each Treatment Plan column like this:

    =COUNTIFS({PersonInteract}, HAS(@cell,[Person Interacted With]@row), {Country}, Country@row, {Date}, >=[Start Date]@row, {Date}, <=[End Date]@row, {HospitalCourse}, HAS(@cell,"Name of column / course to search for"))

    For example, in the "Discharge Plan" column the formula would be:

    =COUNTIFS({PersonInteract}, HAS(@cell,[Person Interacted With]@row), {Country}, Country@row, {Date}, >=[Start Date]@row, {Date}, <=[End Date]@row, {HospitalCourse}, HAS(@cell,"Discharge Plan"))

    The cross sheet references in this formula point to columns on your data sheet.

    When done you should have a sheet something like this that will count for each combination that you're looking for. You can add as many rows as you need to account for as many combinations as you want to count for. I've included rows for another country too like USA.

    BRIAN RICHARDSON | PMO TOOLS AND RESOURCES | HE|HIM

    SEATTLE WA, USA

    IRON MOUNTAIN

«1

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!