Can we nest an IF inside a COUNTIFS in Excel? -
i have been working on attendance sheet , trying make monthly reports automatic. have asked my previous question on same issue , got idea accomplish task.
but have stuck @ 1 place. have below formula:
=countifs(c5:c27,">0", e5:e27,"g", f5:f27,"cat1")
the value in cell "c" in above coming below formula (in cell "c")
=if((countif(g5:ak5,"p"))>0,1,0)
i had add column ("c") supply input fist formula. question - "can merge if function inside countifs result in 1 go , eliminate use of column (column c)"?
to perform these cell reference acrobatics need switch array formula. array formulas chew calculation cycles logarithmically practise narrow referenced ranges minimum. 'helper' column such you've used in column c can reduce calculation cycles , make worksheet more 'user friendly'.
a countifs function requires ranges being examined not same size same shape. looking @ g5:ak5 not same looking @ e5:e35 though contain same number of cells¹.
in sample data below, formula in a1 , uses 'helper column' c. array formula in a2 , not consider column c ahough incorporated logic.
the array formula in a2 is:
=sum(if(e5:e27 = "g", if(f5:f27 = "cat1", sign(countifs(offset($g$5, row($1:$23)-1, 1, 1, 31), $i2)))))
array formulas need finalized ctrl+shift+enter↵. once entered first cell correctly, can filled or copied down or right other formula.
¹some functions not accept welcome cell ranges same number of calls transposed. offsetting or staggering ranges option if cell ranges same size. in difficult cases transpose function can helpful.
Comments
Post a Comment