Hi One and all,
This article will demonstrate that how can we apply further criterias on Filtered data using formulas and get to the conclusions. So here we go:-
So First lets concentrate on Count Part.. The formula I used is..
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B1,ROW(B2:B16)-1,)),--(B2:B16="A"),--(C2:C16>100))
First lets discuss the bold portion only i.e.
SUBTOTAL(3,OFFSET(B1,ROW(B2:B16)-1,))
Which extends to
SUBTOTAL(3,OFFSET(B1,{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15},))
which further extends to
SUBTOTAL(3,{B2;B3;B4;B5;B6;B7;B8;B9;B10;B11;B12;B13;B14;B15,B16})
Now here comes the tricky portion where CountA(3) and Subtotal performs simultaneously.
CountA(3) will count NON Blank cells and show 1 for each non blank cell in the array.
AND
Subtotal will Show Zero for the corresponding hidden cell as it does normally.
Subtotal Function overrides the array given by CountA function (as all cells in the Array are non blanks) and shows Zeros for cells which are hidden.the resultant array would be like this.
{0;1;1;0;1;1;1;1;1;0;1;1;1;1;1}
Here is the Tabular Illustration:-
corresponding array element | ||||
Hidden | A2 | 0 | ||
A3 | 1 | |||
A4 | 1 | |||
Hidden | A5 | 0 | ||
A6 | 1 | |||
A7 | 1 | |||
A8 | 1 | |||
A9 | 1 | |||
A10 | 1 | |||
Hidden | A11 | 0 | ||
A12 | 1 | |||
A13 | 1 | |||
A15 | 1 | |||
A16 | 1 |
This was the tricky part which I hope I have been able to explain well..
Further, --(B2:B16="A") AND --(C2:C16>100) filters the result more with their corresponding conditional arrays and
=SUMPRODUCT({0;1;1;0;1;1;1;1;1;0;1;1;1;1;1},--(B2:B16="A"),--(C2:C16>100))
=SUMPRODUCT({0;1;1;0;1;1;1;1;1;0;1;1;1;1;1},--(B2:B16="A"),--(C2:C16>100))
will return the answer 2 which is evident from the above filtered data.
For sum purposes, we have to add one more range..
--C2:C16
So that sumproduct will return 600 (250+350)
Use FORMULA AUDITING if you wanna understand it more ….
I hope, I have been able to explain it well….
But if you want me to improve the explanation or have any other query then please comment.
I will act upon for sure.
Regards,
Vikas Gautam
Sumproduct with subtotal.xlsx