I am new to Sheets so this might be a straightforward problem. I have a sheet with editions in various states and types. I am trying to count how many editions were created before a particular date for a certain state and type. Example:
Status | Type | Creation time |
---|---|---|
New | cust issue | 2/19/24 |
Accepted | bug | 2/21/24 |
I have a formula in sheets using COUNTIFS
but I get the error:
Array arguments to COUNTIFS are of different size
.
This is my formula:
= Arrayformula(SUM(COUNTIFS('Sheet1'!$F$2:$F$2000 ,{"bug","Cust_issue"},'Sheet1'!$G$2:$G$2000 ,"<" &DATE, 'Sheet1'!$E$2:$E$2000, {"assigned","accepted","new","fixed","verified"})))
What am I doing wrong? The ranges are all the same.
Here's the issue: your ranges are indeed of the same size, but the criteria inside the curly brackets {}
must also be the same in number.
I'm sure there are more elegant solutions, but the simplest one would be to repeat values to artificially match the largest criteria set:
= Arrayformula(SUM(COUNTIFS('Sheet1'!$F$2:$F$2000, {"bug","Cust_issue","bug","Cust_issue","bug"},'Sheet1'!$G$2:$G$2000, "<"&DATE(2024, 10, 03), 'Sheet1'!$E$2:$E$2000, {"assigned","accepted","new","fixed","verified"})))
Notice two things:
cust_issue
;DATE
function since, being a function, it must take arguments in the DATE(year, month, day)
format.EDIT - Here is an alternative formula which uses regular expressions that you could try:
=ROWS(FILTER('Sheet1'!$E$2:$G$2000, REGEXMATCH('Sheet1'!$F$2:$F$2000, "^(?i)(?:bug|Cust_issue)$"),'Sheet1'!$G$2:$G$2000 < DATE(2024, 10, 03), REGEXMATCH('Sheet1'!$E$2:$E$2000, "^(?i)(?:assigned|accepted|new|fixed|verified)$")))
References