Summing with Multiple Criteria --> Sum Changes with Filter

excelNewbie007

New Member
Joined
Jul 25, 2012
Messages
2
I'm trying to find the visible sum of the QUANTITY of GOOD units that aren't DISPOSED yet. If I decide to filter any of the other columns, I want the sum to change accordingly since I'm looking for the visible sum.

Range I want to sum: QUANTITY
A2:A1000

Criteria: CONDITION & DISPOSAL DATE
B2:B1000 = "Good"
C2:C1000 = " "

Notes:
Only sum visible cells, depending on if I apply the filter.

The only functions I know that only measure visible cells are SUBTOTAL and SUMPRODUCT. I've been playing around with these functions, but I can't seem to get it. Like I tried using subtotal(9,____). In the ____, I tried to write a function that followed the criteria AND returned a range, but I was unable to find that. I'm not familiar with pivot tables or name ranges, so if it's possible, stray away from those.

Quantity</SPAN>(A)Condition (B)</SPAN>Disposal Date (C)</SPAN>
2</SPAN>Good</SPAN></SPAN>
3</SPAN>Good</SPAN>
1</SPAN>Good</SPAN>7/19/2012</SPAN>
1</SPAN>Bad</SPAN>
2</SPAN>Good</SPAN>
5</SPAN>Good</SPAN>
1</SPAN>Good</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL><COL><COL></COLGROUP>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I'm trying to find the visible sum of the QUANTITY of GOOD units that aren't DISPOSED yet. If I decide to filter any of the other columns, I want the sum to change accordingly since I'm looking for the visible sum.

Range I want to sum: QUANTITY
A2:A1000

Criteria: CONDITION & DISPOSAL DATE
B2:B1000 = "Good"
C2:C1000 = " "

Notes:
Only sum visible cells, depending on if I apply the filter.

The only functions I know that only measure visible cells are SUBTOTAL and SUMPRODUCT. I've been playing around with these functions, but I can't seem to get it. Like I tried using subtotal(9,____). In the ____, I tried to write a function that followed the criteria AND returned a range, but I was unable to find that. I'm not familiar with pivot tables or name ranges, so if it's possible, stray away from those.

Quantity</SPAN>
(A)
Condition (B)</SPAN>
Disposal Date (C)</SPAN>
2</SPAN>
Good</SPAN>
</SPAN>
3</SPAN>
Good</SPAN>
1</SPAN>
Good</SPAN>
7/19/2012</SPAN>
1</SPAN>
Bad</SPAN>
2</SPAN>
Good</SPAN>
5</SPAN>
Good</SPAN>
1</SPAN>
Good</SPAN>

<TBODY>
</TBODY>
Try this...

=SUMPRODUCT(SUBTOTAL(9,OFFSET(A2,ROW(A2:A1000)-ROW(A2),0)),--(B2:B1000="Good"),--(C2:C1000=" "))
 
Upvote 0
Try this...

=SUMPRODUCT(SUBTOTAL(9,OFFSET(A2,ROW(A2:A1000)-ROW(A2),0)),--(B2:B1000="Good"),--(C2:C1000=" "))
If you have formulas in column C that return " " (space) you should change it so that the formula returns "" (a blank) instead.
 
Upvote 0
If you have formulas in column C that return " " (space) you should change it so that the formula returns "" (a blank) instead.

Hey don't mean to hijack the thread but could you explain how the ROW(A2-A1000)-Row(A2) works?
 
Upvote 0
Hey don't mean to hijack the thread but could you explain how the ROW(A2-A1000)-Row(A2) works?
We have to step through the data one row at a time to get a subtotal for each visible row.

So, we offset the starting cell in the range by n rows. Where n=

ROW(A2)-Row(A2) = 0
ROW(A3)-Row(A2) = 1
ROW(A4)-Row(A2) = 2
ROW(A5)-Row(A2) = 3
ROW(A6)-Row(A2) = 5
ROW(A7)-Row(A2) = 6
etc
etc
etc
 
Upvote 0
We have to step through the data one row at a time to get a subtotal for each visible row.

So, we offset the starting cell in the range by n rows. Where n=

ROW(A2)-Row(A2) = 0
ROW(A3)-Row(A2) = 1
ROW(A4)-Row(A2) = 2
ROW(A5)-Row(A2) = 3
ROW(A6)-Row(A2) = 5
ROW(A7)-Row(A2) = 6
etc
etc
etc
Looks like the sequence is out of sorts!

The correct sequence should be:

ROW(A2)-Row(A2) = 0
ROW(A3)-Row(A2) = 1
ROW(A4)-Row(A2) = 2
ROW(A5)-Row(A2) = 3
ROW(A6)-Row(A2) = 4
ROW(A7)-Row(A2) = 5
etc
etc
 
Upvote 0

Forum statistics

Threads
1,214,574
Messages
6,120,327
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top