count if and sum if on filtered cells (dynamic)

nikos1984

New Member
Joined
Feb 14, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,​
I' m trying to create a dynamic table which will sum the visible rows (C) based on common values (A) and show the result at the end of each repeated value.
More specifically I' m using this specific formula (found online) IF(COUNTIF($A$2:A2;A2)=COUNTIF($A$2:$A$14;A2);SUMIF($A$2:$A$74;A2;$C$2:$C$14);" ") but it doesn't work when I apply filters for specific processes (B).
The repeated values (A) are already filtered and sorted by using the FILTER formula from a helper table.
The basic form of the table is as shown below
ProcessToolCostTotal cost per process
12006SE06900001DKA
4.209,34 €​
4.209,34 €​
22007SE26900000DKA
3.701,63 €​
32007SE26900000DKA
27.878,90 €​
31.580,53 €​
42008SE06900017DKA
4.989,90 €​
52008SE06900017DKA
36.538,38 €​
62008SE06900017DKA
79.072,80 €​
120.601,08 €​
72010SE06900002DKA
9.606,54 €​
9.606,54 €​
82013SE06900000DKA
2.993,31 €​
92013SE06900000DKA
20.479,48 €​
102013SE06900000EKTEDR
72,38 €​
23.545,17 €
112014SE06900001DKA
40.340,97 €​
122014SE06900001DKA
65.222,32 €​
132014SE06900001EPEN
16.020,00 €​
121.583,29 €​
When I apply the filter it shows like below
ProcessToolCostTotal cost per process
12006SE06900001DKA
4.209,34 €​
4.209,34 €​
22007SE26900000DKA
3.701,63 €​
32007SE26900000DKA
27.878,90 €​
31.580,53 €​
42008SE06900017DKA
4.989,90 €​
52008SE06900017DKA
36.538,38 €​
62008SE06900017DKA
79.072,80 €​
120.601,08 €​
72010SE06900002DKA
9.606,54 €​
9.606,54 €​
82013SE06900000DKA
2.993,31 €​
92013SE06900000DKA
20.479,48 €​
?????
112014SE06900001DKA
40.340,97 €​
122014SE06900001DKA
65.222,32 €​
132014SE06900001EPEN
16.020,00 €​
121.583,29 €​
As you can see the 10th row disapeared but it doesn't apply the sum from the 8th and 9th rows.
The result I want is as show below
ProcessToolCostTotal cost per process
12006SE06900001DKA
4.209,34 €​
4.209,34 €​
22007SE26900000DKA
3.701,63 €​
32007SE26900000DKA
27.878,90 €​
31.580,53 €​
42008SE06900017DKA
4.989,90 €​
52008SE06900017DKA
36.538,38 €​
62008SE06900017DKA
79.072,80 €​
120.601,08 €​
72010SE06900002DKA
9.606,54 €​
9.606,54 €​
82013SE06900000DKA
2.993,31 €​
92013SE06900000DKA
20.479,48 €​
23.472,79 €
112014SE06900001DKA
40.340,97 €​
122014SE06900001DKA
65.222,32 €​
132014SE06900001EPEN
16.020,00 €​
121.583,29 €​
I' ve tried the SUMPRODUCT-SUBTOTAL-OFFSET solution but it doesn't seem to work
Any sugestion will be much appreciated
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
How about
Fluff.xlsm
ABCDE
1ProcessToolCostTotal cost per process
22006SE06900001DKA4209.3414209.34
32007SE26900000DKA3701.631 
42007SE26900000DKA27878.9131580.53
52008SE06900017DKA4989.91 
62008SE06900017DKA36538.381 
72008SE06900017DKA79072.81120601.08
82010SE06900002DKA9606.5419606.54
92013SE06900000DKA2993.311 
102013SE06900000DKA20479.48123472.79
122014SE06900001DKA40340.971 
132014SE06900001DKA65222.321 
142014SE06900001EPEN160201121583.29
Main
Cell Formulas
RangeFormula
D2:D10,D12:D14D2=SUBTOTAL(103,A2)
E2:E10,E12:E14E2=IF(COUNTIFS(A$2:A2,A2,D$2:D2,1)=COUNTIFS(A:A,A2,D:D,1),SUMIFS(C:C,A:A,A2,D:D,1),"")
 
Upvote 1
Solution
Works like a charm!
Thank you very much
Very elegant way to nest subtotal
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,644
Messages
6,125,993
Members
449,279
Latest member
Faraz5023

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