Add Dynamic Sum with Dynamic Array when using SUMIFS

LearnMeExcel

Well-known Member
Joined
Aug 11, 2009
Messages
746
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all
i solve the first Problem for Dynamic name With Filter by @Fluff
on the Same Data
i want to Add Dynamic Sum with Same Dynamic Formula
this is my data
Invoice Number​
Date​
Company Name​
Amount​
Currency​
Status​
V - 141​
15/01/2021​
XYZ​
1153.132​
USD​
Not Paid​
V - 157​
17/01/2021​
FHG​
4491.818​
USD​
Paid​
V - 158​
26/01/2021​
ZJC​
6076.498​
USD​
Paid​
V - 167​
16/02/2021​
FHG​
1105.557​
USD​
Paid​
V - 173​
17/02/2021​
XYZ​
7338.599​
USD​
Paid​
V - 184​
21/02/2021​
CDE​
2176.351​
USD​
Paid​
V - 194​
06/03/2021​
THC​
7663.309​
USD​
Paid​
V - 204​
07/03/2021​
ZJC​
2955.909​
USD​
Paid​
V - 252​
23/03/2021​
MFC​
4456.528​
USD​
Paid​
V - 278​
28/03/2021​
ABC​
3432.406​
USD​
Paid​
V - 306​
28/03/2021​
MFC​
3381.936​
USD​
Not Paid​
V - 325​
31/03/2021​
JBR​
7563.771​
USD​
Paid​
V - 326​
31/03/2021​
FHG​
4094.144​
USD​
Paid​
V - 327​
19/04/2021​
EFG​
7828.469​
USD​
Paid​
V - 330​
21/04/2021​
MFC​
6602.376​
USD​
Not Paid​
V - 342​
23/04/2021​
XYZ​
2979.044​
USD​
Paid​
V - 374​
25/04/2021​
FHG​
7932.121​
USD​
Paid​
V - 387​
05/05/2021​
FHG​
3621.784​
USD​
Paid​
V - 397​
06/05/2021​
FHG​
4714.177​
USD​
Paid​
V - 415​
27/05/2021​
JBR​
4942.058​
USD​
Paid​
V - 433​
27/05/2021​
CDE​
7999.256​
USD​
Paid​
V - 434​
31/05/2021​
ABC​
2743.007​
USD​
Paid​
V - 478​
31/05/2021​
THC​
1122.415​
USD​
Paid​
V - 523​
02/06/2021​
EFG​
4673.887​
USD​
Paid​
V - 524​
16/06/2021​
JBR​
2126.972​
USD​
Paid​
V - 531​
21/06/2021​
XYZ​
8576.646​
USD​
Not Paid​
V - 544​
25/06/2021​
MFC​
8452.265​
USD​
Not Paid​
V - 616​
27/06/2021​
FHG​
6481.728​
USD​
Paid​
V - 637​
07/07/2021​
CDE​
4694.205​
USD​
Not Paid​
V - 671​
08/07/2021​
MFC​
3248.498​
USD​
Not Paid​
V - 677​
24/07/2021​
ZJC​
2986.056​
USD​
Paid​
V - 703​
07/08/2021​
THC​
1342.146​
USD​
Paid​
V - 759​
11/09/2021​
JBR​
4226.128​
USD​
Paid​
V - 770​
12/09/2021​
ZJC​
1949.528​
USD​
Paid​
V - 815​
14/09/2021​
MFC​
5725.759​
USD​
Not Paid​
V - 846​
28/09/2021​
FHG​
8204.793​
USD​
Paid​
V - 861​
29/09/2021​
MFC​
6108.563​
USD​
Paid​
V - 887​
01/10/2021​
FHG​
2274.161​
USD​
Paid​
V - 903​
10/10/2021​
ZJC​
5287.774​
USD​
Paid​
V - 910​
12/10/2021​
ZJC​
7230.193​
USD​
Not Paid​
V - 913​
12/10/2021​
ABC​
1109.748​
USD​
Paid​
V - 926​
29/10/2021​
CDE​
2849.42​
USD​
Paid​
V - 929​
01/11/2021​
FHG​
4117.116​
USD​
Paid​
V - 934​
04/11/2021​
MFC​
4752.744​
USD​
Paid​
V - 937​
07/11/2021​
XYZ​
4851.978​
USD​
Paid​
V - 938​
14/11/2021​
CDE​
7279.049​
USD​
Not Paid​
V - 965​
27/11/2021​
XYZ​
2766.666​
USD​
Paid​
V - 966​
28/11/2021​
JBR​
4601.909​
USD​
Paid​
V - 985​
06/12/2021​
CDE​
1092.158​
USD​
Paid​
V - 986​
15/12/2021​
EFG​
1015.34​
USD​
Not Paid​

my Unique list


Not Paid​
CDE​
EFG​
MFC​
XYZ​
ZJC​
By Formula
=SORT(UNIQUE(FILTER(INDEX(Invoice_data,,3),INDEX(Invoice_data,,6)="Not Paid")))
And i used SUMIFS


Not Paid​
Amount​
CDE​
11973.25​
=IF(I2#="",SUM($J$1:J1),SUMIFS(INDEX(Invoice_data,0,4),INDEX(Invoice_data,0,3),I2#,INDEX(Invoice_data,0,6),"Not Paid"))​
EFG​
1015.34​
MFC​
27410.83​
XYZ​
9729.778​
ZJC​
7230.193​

but Sum doesn't work to give me after last value the total for all

Can we do that ???

1640032414401.png
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
In I2 use
Excel Formula:
=LET(s,SORT(UNIQUE(FILTER(INDEX(Invoice_data,,3),INDEX(Invoice_data,,6)="Not Paid"))),IFERROR(INDEX(s,SEQUENCE(ROWS(s)+1)),""))
and in J2
Excel Formula:
=LET(s,SUMIFS(INDEX(Invoice_data,0,4),INDEX(Invoice_data,0,3),I2#,INDEX(Invoice_data,0,6),"Not Paid"),IF(I2#="",SUM(s),s))
 
Upvote 0
Solution
Just To understand, why i get zero as results if i use this function in Column J
Excel Formula:
=IF(I2#="Total",SUMIFS(INDEX(invoice_data,,4),INDEX(invoice_data,,3),I2#,INDEX(invoice_data,,6),"Not Paid"),SUM($J$1:J1))

Not PaidAmount
CDE
0.00​
EFG
0.00​
MFC
0.00​
XYZ
0.00​
Yahya
0.00​
ZJC
0.00​
Total
0.00​
 
Upvote 0
Firstly it looks as though you have the if statement the wrong way round & secondly you cannot use SUM($J$1:J1) in a spilled array as it will only look at J$1:J1
 
Upvote 0
Firstly it looks as though you have the if statement the wrong way round & secondly you cannot use SUM($J$1:J1) in a spilled array as it will only look at J$1:J1
Yes, I noticed the error after I added the reply.
and as understand Excel can't Evaluate SUM($J$1:J1) to change the range through dynamic Array.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
another case if it is possible
if i want Report Vertical and Horizontal like (Pivot Table ) and Sum Vertical and Horizontal and Grand Total if it is Possible, i try this Formulas

is it possible by Dynamic array
MrExcel Site.xlsx
ABCDEFGHIJKLM
1Invoice NumberDateCompany Name AmountCurrencyStatusNot PaidCNYRUBUSDHTotal
2V - 14115/01/2021Abc1153.132USDNot PaidAbc7,230.190.001,153.130.00
3V - 15717/01/2021FHG4491.818EURPaidCDE7,279.054,694.210.000.00
4V - 15826/01/2021ZJC6076.498CNYPaidEFG1,015.340.000.000.00
5V - 16716/02/2021FHG1105.557JPYPaidMFC3,381.9417,550.9015,054.640.00
6V - 17317/02/2021XYZ7338.599CNYPaidVTotal57,359.4057,359.4057,359.4057,359.40
7V - 18421/02/2021CDE2176.351CNYPaid
8V - 19406/03/2021THC7663.309RUBPaid
9V - 20407/03/2021ZJC2955.909JPYPaid
10V - 25223/03/2021MFC4456.528JPYPaid
11V - 27828/03/2021ABC3432.406RUBPaid
12V - 30628/03/2021MFC3381.936CNYNot Paid
13V - 32531/03/2021JBR7563.771USDPaid
14V - 32631/03/2021FHG4094.144CNYPaid
15V - 32719/04/2021EFG7828.469RUBPaid
16V - 33021/04/2021MFC6602.376USDNot Paid
17V - 34223/04/2021XYZ2979.044RUBPaid
18V - 37425/04/2021FHG7932.121USDPaid
19V - 38705/05/2021FHG3621.784CNYPaid
20V - 39706/05/2021FHG4714.177RUBPaid
21V - 41527/05/2021JBR4942.058JPYPaid
22V - 43327/05/2021CDE7999.256CNYPaid
23V - 43431/05/2021ABC2743.007USDPaid
24V - 47831/05/2021THC1122.415JPYPaid
25V - 52302/06/2021EFG4673.887USDPaid
26V - 52416/06/2021JBR2126.972JPYPaid
27V - 53121/06/2021MFC8576.646RUBNot Paid
28V - 54425/06/2021MFC8452.265USDNot Paid
29V - 61627/06/2021FHG6481.728CNYPaid
30V - 63707/07/2021CDE4694.205RUBNot Paid
31V - 67108/07/2021MFC3248.498RUBNot Paid
32V - 67724/07/2021ZJC2986.056EURPaid
33V - 70307/08/2021THC1342.146RUBPaid
34V - 75911/09/2021JBR4226.128CNYPaid
35V - 77012/09/2021ZJC1949.528EURPaid
36V - 81514/09/2021MFC5725.759RUBNot Paid
37V - 84628/09/2021FHG8204.793JPYPaid
38V - 86129/09/2021MFC6108.563USDPaid
39V - 88701/10/2021FHG2274.161EURPaid
40V - 90310/10/2021ZJC5287.774EURPaid
41V - 91012/10/2021Abc7230.193CNYNot Paid
42V - 91312/10/2021ABC1109.748RUBPaid
43V - 92629/10/2021CDE2849.42JPYPaid
44V - 92901/11/2021FHG4117.116USDPaid
45V - 93404/11/2021MFC4752.744EURPaid
46V - 93707/11/2021XYZ4851.978CNYPaid
47V - 93814/11/2021CDE7279.049CNYNot Paid
48V - 96527/11/2021XYZ2766.666JPYPaid
49V - 96628/11/2021JBR4601.909USDPaid
50V - 98506/12/2021CDE1092.158JPYPaid
51V - 98615/12/2021EFG1015.34CNYNot Paid
iDB-VH
Cell Formulas
RangeFormula
J1:M1J1=LET(v,TRANSPOSE(SORT(UNIQUE(FILTER(INDEX(invoice_data,,5),INDEX(invoice_data,,6)="Not Paid")))),IFERROR(INDEX(v,SEQUENCE(,COLUMNS(v)+1)),"HTotal"))
I2:I6I2=LET(s,SORT(UNIQUE(FILTER(INDEX(invoice_data,,3),INDEX(invoice_data,,6)="Not Paid"))),IFERROR(INDEX(s,SEQUENCE(ROWS(s)+1)),"VTotal"))
J2:M6J2=LET(s,SUMIFS(INDEX(invoice_data,0,4),INDEX(invoice_data,0,3),I2#,INDEX(invoice_data,0,6),"Not Paid",INDEX(invoice_data,0,5),J1#),V,SUMIFS(INDEX(invoice_data,0,4),INDEX(invoice_data,0,3),I2#,INDEX(invoice_data,0,6),"Not Paid"),H,SUMIFS(INDEX(invoice_data,0,4),INDEX(invoice_data,0,6),"Not Paid",INDEX(invoice_data,0,5),J1#),IF(I2#="VTotal",SUM(V),s))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
'iDB-VH'!_FilterDatabase='iDB-VH'!$A$1:$F$51J1:J2, I2
invoice_data=OFFSET('iDB-VH'!$A$1,1,0,COUNTA('iDB-VH'!$A:$A)-1,6)J1:J2, I2
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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