Subtotal and sum if ?

KevBarry

New Member
Joined
Sep 12, 2018
Messages
7
Have tried (and googled) this before without success so here goes.

Rough example:
I have a number of projects with a filter applied at ROW 4, what is the formula in C2/C3 that will generate the totals when the filter is active?

Thanks in advance
Kev




ABC
1NarrativeTotals
2Income
3Expenditure
4Project #NarrativeValue
5AIncome1000
6AExpenditure500
7BIncome2000
8BExpenditure300

<tbody>
</tbody>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Code:
=sumproduct(subtotal(3,offset($b$6,row($b$6:$b$9)-row($b$6),,,))*($c$6:$c$9)*($b$6:$b$9=b3))
 
Upvote 0
Thanks for your reply but I am confused by your $b$6 reference as that does not make any logical sense to me ??? would you not be looking at B2 for income or B3 for expenditure?
 
Upvote 0
Sorry I had a different setup of cells in my sheet.

In C2 use this
Code:
=SUMPRODUCT(SUBTOTAL(3,OFFSET($B$5,ROW($B$5:$B$8)-ROW($B$5),,,))*($C$5:$C$8)*($B$5:$B$8=B2))
 
Upvote 0
A little less expensive...


Book1
ABC
1NarrativeTotals
2Income3000
3Expenditure800
4Project #NarrativeValue
5AIncome1000
6AExpenditure500
7BIncome2000
8BExpenditure300
Sheet1


In C2 enter and copy down to C3:

=SUMPRODUCT(SUBTOTAL(9,OFFSET($C$5,ROW($C$5:$C$200)-ROW($C$5),0)),--($B$5:$B$200=$B2))
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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