COUNTIFS from multi-select drop down
Hi Community, hope you are well!
I would really appreciate some help with the following formula.
In a master metric sheet I would like to count multiple criteria. I am using this formula which works great since it is automated once the @row are filled in by my Team:
=COUNTIFS({Planning sheet Range 2}, PA@row, {Planning sheet Range 3}, Year@row, {Planning sheet Range 4}, Status@row)
问题是当“Status@row”我s a multi-select, the formula above would count with an implicit AND function, thus, when all the criteria in the multiselect are met. In my case I am interested in an OR function, hence, given the PA and the Year I want to count multiple status from the multiselect at once.
I can opt for the following:
=COUNTIFS({Planning sheet Range 2}, PA@row, {Planning sheet Range 3}, Year@row, {Planning sheet Range 4}, OR(@cell = "Scheduled", @cell = "Posted to System"))
The problem is that this formula would require my Team to edit the Status section of the formula each time - adding and removing elements of the OR function - rather than simply working on the drop down column.
Hope my question is clear enough and very grateful to whom will spend time to help me!
Best,
Alessandro
Best Answer
-
Leibel S ✭✭✭✭✭✭
In regards to your question about blank PA , YEAR , or STATUS.
You can add an OR statement into your formula. The syntax would be as shown below:
=COUNTIFS({Planning sheet Range 2}, OR(ISBLANK(PA@row),@cell = PA@row) , {Planning sheet Range 3}, OR(ISBLANK(Year@row),@cell = Year@row), {Planning sheet Range 4}, OR(ISBLANK(Status@row), HAS(Status@row, @cell)))
Answers
-
Paul Newcome ✭✭✭✭✭✭
Why does your team need to edit the "@row" portion of the formula? What exactly are they changing?
As for the status options... How many different options could there be selected at any one time?
-
Hi Paul,
my Team won't ever edit the @row indeed, in the case of the second formula
=COUNTIFS({Planning sheet Range 2}, PA@row, {Planning sheet Range 3}, Year@row, {Planning sheet Range 4}, OR(@cell = "Scheduled", @cell = "Posted to System")
they would need to change the @cell only. My question is how to avoid this to happen? I would like them to be able to fill up information columns (PA [text], Year [text], Status [multi drop down]) only without editing any formula. Hence, a formula that would behave like the first formula:
=COUNTIFS({Planning sheet Range 2}, PA@row, {Planning sheet Range 3}, Year@row, {Planning sheet Range 4}, Status@row)
BUT allowing the Status@row to be multi-select and counting when more than one status are combined even if they are not combined in the source sheet.
Re: How many different options could there be selected at any one time? Between 2 and 4 maximum
-
Paul Newcome ✭✭✭✭✭✭
You could create some extra single select columns and reference them in the formula. Have your team make a single selection in each of the 4 columns (or leave blank as applicable).
-
Yes, I thought about the extra columns but wanted to make sure an easier solution wasn't available. I understand it's not.
Thank you Paul.
One more question, please if you don't mind. In the first formula:
=COUNTIFS({Planning sheet Range 2}, PA@row, {Planning sheet Range 3}, Year@row, {Planning sheet Range 4}, Status@row)
When in the METRICS sheet one of the values the @row components reference to (either the PA, Year or Status) is blank, the formula would return 0 because it is counting how many times in the SOURCE sheet the exact combination (which includes the blank cell) can be found. Let's assume that in the SOURCE sheet PA/Year/Status are always assigned, thus never blank.
Would I want the formula to return in the METRICS sheet though is to automatically count also when one of the elements is missing. This means that in the METRICS my Team can also have combinations as the following:
PA + Year + No Status: count how many times PA (1) in Year (2020) regardless of the status
No PA + Year + Status: count regardless of the PA, Status (In Progress) occur in Year (2020)
PA + No Year + Status: count how many times PA(1) is in Status (In Progress) regardless of the Year
Further example: PA(1) + No Year + No Status: returns how many times PA(1) is observed in the source sheet regardless of the year and status.
Would this be possible?
-
Leibel S ✭✭✭✭✭✭
Regarding your original multi select issue the below should solve that by using the has function.
This would allow you to choose multiple statuses in the status cell and any row that matches one of those statuses would be counted.
=COUNTIFS({Planning sheet Range 2}, PA@row, {Planning sheet Range 3}, Year@row, {Planning sheet Range 4}, HAS(Status@row, @cell))
-
Leibel S ✭✭✭✭✭✭
In regards to your question about blank PA , YEAR , or STATUS.
You can add an OR statement into your formula. The syntax would be as shown below:
=COUNTIFS({Planning sheet Range 2}, OR(ISBLANK(PA@row),@cell = PA@row) , {Planning sheet Range 3}, OR(ISBLANK(Year@row),@cell = Year@row), {Planning sheet Range 4}, OR(ISBLANK(Status@row), HAS(Status@row, @cell)))
-
Paul Newcome ✭✭✭✭✭✭
@Leibel SIt looks like you may be on to something, but you are going to want to change your ISBALNK statements to contain an @cell reference instead of [Column Name]@row].
-
Leibel S ✭✭✭✭✭✭
My pleasure.
After figuring this one out I went back to an older formula and was able to make it half the size using this technique :)
Help Article Resources
Categories
=if(countif([due date]:[due date],<today()) = 0,\"Green\",if(count([due date]:[due date]) * .1 >countif([due date]:[due date],<today()),\"Yellow\",\"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":[]},{"discussionID":111265,"type":"question","name":"Calculating fines due based on calendar date","excerpt":"Hi, I am looking for help with calculating fines based on a missed due date, and the subsequent number of calendar days past the due date. Ideally, I would like the fine to calculate in two instances. 1) if the date in \"Y1Q1 Date Payment RCVD\" is greater than the due date, OR 2). the date is blank and today's date is…","snippet":"Hi, I am looking for help with calculating fines based on a missed due date, and the subsequent number of calendar days past the due date. Ideally, I would like the fine to…","categoryID":322,"dateInserted":"2023-10-05T17:03:50+00:00","dateUpdated":null,"dateLastComment":"2023-10-05T18:35:56+00:00","insertUserID":168047,"insertUser":{"userID":168047,"name":"Stitched","url":"https:\/\/community.smartsheet.com\/profile\/Stitched","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-05T18:27:31+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":120260,"lastUser":{"userID":120260,"name":"David Tutwiler","title":"","url":"https:\/\/community.smartsheet.com\/profile\/David%20Tutwiler","photoUrl":"https:\/\/lh3.googleusercontent.com\/a-\/AOh14GiIpuCpV7Zvo9nduJmLt8ULNYObTVazzemdnIiy6w=s96-c","dateLastActive":"2023-10-05T20:38:02+00:00","banned":0,"punished":0,"private":false,"label":"Overachievers Alumni"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":17,"score":null,"hot":3393058186,"url":"https:\/\/community.smartsheet.com\/discussion\/111265\/calculating-fines-due-based-on-calendar-date","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/111265\/calculating-fines-due-based-on-calendar-date","format":"Rich","lastPost":{"discussionID":111265,"commentID":398719,"name":"Re: Calculating fines due based on calendar date","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/398719#Comment_398719","dateInserted":"2023-10-05T18:35:56+00:00","insertUserID":120260,"insertUser":{"userID":120260,"name":"David Tutwiler","title":"","url":"https:\/\/community.smartsheet.com\/profile\/David%20Tutwiler","photoUrl":"https:\/\/lh3.googleusercontent.com\/a-\/AOh14GiIpuCpV7Zvo9nduJmLt8ULNYObTVazzemdnIiy6w=s96-c","dateLastActive":"2023-10-05T20:38:02+00:00","banned":0,"punished":0,"private":false,"label":"Overachievers Alumni"}},"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,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/M47QMCUFOQU2\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/M47QMCUFOQU2\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/M47QMCUFOQU2\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/M47QMCUFOQU2\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/M47QMCUFOQU2\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/M47QMCUFOQU2\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-05T20:33:37+00:00","dateAnswered":"2023-10-05T17:40:08+00:00","acceptedAnswers":[{"commentID":398693,"body":"
I think this will work. The first part of the formula handles if a payment was received but was past the due date, and the second part handles if TODAY() is past the due date but no payment shows as received. It should return blank if neither requirements are met, so it inherently solves the third example.<\/p>
Formula<\/strong><\/p> =IF(NOT(ISBLANK([Y1Q1 Date Payment RCVD]@row)), IF([Y1Q1 Date Payment RCVD]@row > [Due Date]@row, [Y1Q1 Date Payment RCVD]@row - [Due Date]@row), IF(TODAY() > [Due Date]@row, TODAY() - [Due Date]@row))<\/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":111252,"type":"question","name":"Convert Text to Date","excerpt":"I am looking for help to convert 20230818 ['Max Date' text formatted column] to read 08\/18\/2023 in the ['Last Activity Date' date formatted column]. However, the formula that I am using returns a value of #INCORRECT ARGUMENT SET. =DATE(VALUE(MID([Max Date]@row, 5, 2), (VALUE(RIGHT([Max Date]@row, 2), (VALUE(LEFT([Max…","snippet":"I am looking for help to convert 20230818 ['Max Date' text formatted column] to read 08\/18\/2023 in the ['Last Activity Date' date formatted column]. However, the formula that I am…","categoryID":322,"dateInserted":"2023-10-05T14:43:03+00:00","dateUpdated":null,"dateLastComment":"2023-10-05T16:30:55+00:00","insertUserID":165028,"insertUser":{"userID":165028,"name":"Heather P.","title":"Project Manager","url":"https:\/\/community.smartsheet.com\/profile\/Heather%20P.","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!jQ9z43MAzno!g06wZ9dLOEg!WMaAtvFiz-H","dateLastActive":"2023-10-05T20:23:56+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":142964,"lastUser":{"userID":142964,"name":"Ray Lindstrom","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Ray%20Lindstrom","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/5Y0KP6UKIBTU\/nY3615V0DPRZV.jpg","dateLastActive":"2023-10-05T20:45:58+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":5,"countViews":31,"score":null,"hot":3393043438,"url":"https:\/\/community.smartsheet.com\/discussion\/111252\/convert-text-to-date","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/111252\/convert-text-to-date","format":"Rich","lastPost":{"discussionID":111252,"commentID":398665,"name":"Re: Convert Text to Date","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/398665#Comment_398665","dateInserted":"2023-10-05T16:30:55+00:00","insertUserID":142964,"insertUser":{"userID":142964,"name":"Ray Lindstrom","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Ray%20Lindstrom","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/5Y0KP6UKIBTU\/nY3615V0DPRZV.jpg","dateLastActive":"2023-10-05T20:45:58+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,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/XEL3OVI7TIKD\/snag-853419.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/XEL3OVI7TIKD\/snag-853419.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/XEL3OVI7TIKD\/snag-853419.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/XEL3OVI7TIKD\/snag-853419.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/XEL3OVI7TIKD\/snag-853419.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/XEL3OVI7TIKD\/snag-853419.png"},"alt":"Snag_853419.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-05T15:59:30+00:00","dateAnswered":"2023-10-05T15:14:46+00:00","acceptedAnswers":[{"commentID":398634,"body":"