Help on formula: Countifs with multiple columns and criteria
Hi,
So I've been working on a formula but couldn't get it right. I wanted to count the number of my projects that are Active (on-time) and Active (delayed).
我准时计数正确但菲律宾人质yed ones I always get a plus 1 in the results. Here's the formula I use (btw the stages represents that a project is active):
Active (on-time)
=COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "planning") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "strategy") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "tender") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "evaluation") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "contract")
Active (delayed)
=COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "planning") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "strategy") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "tender") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "evaluation") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "contract")
Can anybody please check and advise what's the correct formula I should use?
Kind regards,
Grace
Comments
-
Shaine Greenwood Employee
Hi Grace,
Based on what you're wanting your formulas to count, the syntax of both of them looks correct.
How are you comparing results to know that your "delayed" always has an incorrect +1 in the results? Are you manually counting and then checking against the formula? Are you using a feature in Smartsheet (besides formulas) to try and manually count?
To troubleshoot this, here's what I would do:
- Disable any filters on your sheet by clicking the filter button in the toolbar
- Break your delayed COUNTIFS down piece-by-piece. Start with just using a =COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "planning") and see how your results compare.
- Repeat this for each section of your formula.
-
Grace ✭
Hi Shaine,
Yes, I am manually counting and then checking against the formula. I tried to enter the delayed countifs one by one but I'm getting the same results. I have one project under Strategy stage with progress as on-time and I have found that this is where the plus one is coming from.
Here's the formula:
=COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "planning") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "strategy") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "tender") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "evaluation") + COUNTIFS(Progress:Progress, "delayed", Stage:Stage, "contract")
What's odd is that I am getting the calculations right for my active and on-time projects even if I am using the similar formula.
=COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "planning") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "strategy") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "tender") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "evaluation") + COUNTIFS(Progress:Progress, "on-time", Stage:Stage, "contract")
Kind regards,
Grace
-
Grace ✭
Hi Shaine,
I just wanted to check if there's any update regarding this please?
Thanks,
Grace
-
Hi Grace,
Hopefully you have sorted this out by now, but if not....
As Shaine mentioned, you should remove the filters to see why you are not getting the correct result. It appears you have a filter on the Status column that is set to "Active".
You also have a filter on the project name. I can't tell exactly what it is, but I suspect that it includes project names matching Strategy, Contract, etc.
There is probably a row with either
- a status that is not active, but a valid stage and progress delayed
- a typo in the project name column, so it is hidden by your filter, but which has a valid stage and progress delayed
If you set exactly the same criteria in the filters as you have in your countifs, you should find the culprit.
You could also simplify your criteria, how about just counting the Project header lines? One way to identify these is a non-blank reference, I think, which simplifies your formula to
=COUNTIFS([Project Ref #]:[Project Ref #],<>"",Progress:Progress, "on-time", Status:Status, "active")
and
=COUNTIFS([Project Ref #]:[Project Ref #],<>"",Progress:Progress, "delayed", Status:Status, "active")
since you do not care about the stage of the project, just that it is active.
-
Grace ✭
Hi Andrew,
Thank you for your response. You were right about using the Project Ref # column! It makes more sense now.
Cheers,
Grace
-
Glad to have been able to help
-
Shaine Greenwood Employee
Hi Grace—
Sorry for not seeing and responding back to this earlier. Looks like Andrew pitched in and worked out a solution with you.
Thanks Andrew!
Help Article Resources
Categories
Check out theFormula Handbook template!
Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>
=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>
Thank you,<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":109493,"type":"question","name":"I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","excerpt":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5 different statuses in a separate column. So using the screenshot I've provided as an example (although it doesn't have 5 different statuses in the…","snippet":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5…","categoryID":322,"dateInserted":"2023-08-25T20:03:21+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:34:49+00:00","insertUserID":165710,"insertUser":{"userID":165710,"name":"SmarsheetNewb","url":"https:\/\/community.smartsheet.com\/profile\/SmarsheetNewb","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:33:27+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3386005690,"url":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109493,"commentID":392692,"name":"Re: I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392692#Comment_392692","dateInserted":"2023-08-26T00:34:49+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:33:25+00:00","dateAnswered":"2023-08-25T20:44:12+00:00","acceptedAnswers":[{"commentID":392662,"body":"
Try this:<\/p>
=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"