I'm trying to sum rows with specific criteria with the following formula:
=ArrayFormula(sum(countifs(disposition,"Consultation" ,Primary,{"","OB_Gyn","Surgical"},Consultations,{"*IM*","*Cardio*","*Nephro*","*Neuro*","*GI*",""})))
where disposition
, Primary
, Consultations
are NamedRanges of columns with same rows 9-58.
But I get the error message.
#value!
Array arguments to COUNTIFS are of different size.
Best Answer
EDIT (following OP's comment
You can easily alter the formula with something like the following
The basic difference is
COUNTBLANK
that we bring in our formula because we can not count blanks using the regex.Original answer
Instead of your countifs formula you could try the following
What the formula does
REGEXMATCH
in combination with theArrayFormula
function we come up withTRUE
orFALSE
results.TRUE
andFALSE
correspond to1
and0
values, we use theN
function to turn them to1
s and0
s respectively.SUM
to get the desired result.