Does COUNTIFS work with only 2 conditions?
Ive been trying to add multiple conditions in to calculate some values for my Sheet Summary, but I cant seem to add more than 2 conditions. Each of them work individually & with 2 conditions, but when i add the third condition it always shows '0'. What am i doing wrong?
The formula I'm using is:
=COUNTIFS([Overall Status]:[Overall Status], "Selected", [Overall Status]:[Overall Status], "WIP", [Overall Status]:[Overall Status], "Pending Verification")
Answers
-
Hello Avantika
My understanding of the COUNTIFS function is that ALL the criteria must meet true to be counted. So the COUNTIFS function can take as many conditions as is required to fulfil the logic of the query, however each condition must be on different columns. So you could say CountIF the Overall Status is "Selected" and the % Complete is 100% and the Status is "Complete" and the Risk Raised is 0 etc but you cannot ask the same column to match against two different values as in the example you have posted.
My recommendation is to set up a helper column with a nested IF function in it to tick a box if the Overall Status is one of the values you have put in your example, then just count the ticks in that helper column.
Helper column called INSTATUS with a checkbox data type and the following formula in it
=IF(OR([Overall Status]@row = "Selected",[Overall Status]@row = "WIP",[Overall Status]@row = "Pending Verification"),1,0)
Then in a different cell simply =COUNTIF(INSTATUS:INSTATUS,1)
Hope this helps.
Kind regards
Debbie
-
You could also work an OR function into your COUNTIFS to avoid having to use the extra column.
=COUNTIFS([Overall Status]:[Overall Status], OR(@cell = "Selected", @cell = "WIP", @cell = "Pending Verification"))
COUNTIFS basically defaults to AND, so you are saying to count those rows where the [Overall Status] is "Selected" AND is "WIP" AND is "Pending Verification". The problem with this is that a cell cannot equal two different things at the same time.
-
Thank you so much, this really helps!
-
Happy to help! 👍️
Please don't forget to mark the most appropriate response(s) as "helpful". That way others searching for a similar solution can know that one may be found here.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!