Reputation: 321
Goal: If possible I want to simplify the following statement. The functionality is to count data that has a status called "Finished A" "Finished B" or "Finished C." And the reference for $K$2 is referring to a cell with a particular date.
For example, if Finished A had 3, Finished B had 2, and Finished C had 4, then the total count would be 9. That's the calculations.
=COUNTIFS('Data'!$D$4:$D,"Finished A",'Data'!$G$4:$G,"="&$K$2) +
COUNTIFS('Data'!$D$4:$D,"Finished B",'Data'!$G$4:$G,"="&$K$2) +
COUNTIFS('Data'!$D$4:$D,"Routed C",'Data'!$G$4:$G,"="&$K$2)
Challenge: This particular example above is quite simple so it's manageable and if I need to make any changes, it's not going to be a problem. However if there are more criteria, then it would gets very long and difficult to read and manage. So if there's a way to shorten the above, it would be great. In the above case, I think there could there a way to combine the different statuses by using the OR logic (ex. |).
There was a case where I used "|" symbol to make an OR logic when using the Query function, however it didn't work with the Countifs functions.
Question: Is there a way to do something like the following?
=COUNTIFS('Data'!$D$4:$D,"Finished A|Finished B|Finished C",'Data'!$G$4:$G,"="&$K$2)
Upvotes: 0
Views: 211
Reputation: 11968
Try:
=ArrayFormula(SUM(COUNTIFS($A$2:$A,{"A","B","C"},$B$2:$B,$D$2)))
Upvotes: 1