Dynamic Sum Vertical and Horizontal By Formula like PivotTable

LearnMeExcel

Well-known Member
Joined
Aug 11, 2009
Messages
746
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi All
i have this Question, i am using dynamic Array Formula to get the Sum of values Vertical and Horizontal and it is working Perfectly, and @Fluff Helped me in Most of them.
But i am trying to add Dynamic Sum Vertical and Horizontal (Subtotals) like PivotTable, and if it is Possible Also Grand.
Can we do that By Dynamic Arrays Formula
this is my data and Formulas
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
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about like
Excel Formula:
=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",H,IF(J1#="HTotal",V,s)))
 
Upvote 0
And to get the grand total as well
Excel Formula:
=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),INDEX(I2#,SEQUENCE(ROWS(I2#)-1)),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),INDEX(J1#,SEQUENCE(,COLUMNS(J1#)-1))),IFNA(IF(I2#="VTotal",H,IF(J1#="HTotal",V,s)),SUM(V)))
 
Upvote 0
Solution
And to get the grand total as well
Excel Formula:
=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),INDEX(I2#,SEQUENCE(ROWS(I2#)-1)),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),INDEX(J1#,SEQUENCE(,COLUMNS(J1#)-1))),IFNA(IF(I2#="VTotal",H,IF(J1#="HTotal",V,s)),SUM(V)))
is it Excel or Magic
Really you are amazing @Fluff

A million of Thanks for you ❤️❤️❤️
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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