Table summary

Holger

New Member
Joined
Nov 22, 2017
Messages
44
Office Version
  1. 365
Platform
  1. MacOS
Hi everyone,

I have the following data, which is only a snapshot:

* col 1 and 2 are category and sub-category, col 3 to col 131 is periods from Oct 2023 to.....whatever
* what periods to summarise is determined by the two fields at the top Beginning and Ending, where someone can choose two periods in the range col 3-131. In the screen below I have only shown Dec 24, Jan 25, Feb 25
* I currently have long, complex formulas that create summary tables, which I further use for graphs.
* current formulas are many: unique to create the categories, then index/match to pick up the periods, and then sumproduct to populate these rows and columns

I'm sure there is a better way to get this done more efficiently. I managed to pull the respective columns with choosecols in a LET function but cant get the grouping down by category. I tried this LET thing before and got it working but that was more copying and adjusting with the help of someone from this forum. 🙏. I just don't get this thing completely 😭.

I would like to achieve the small table below the row "desired result." The number of columns and subsequent calcs will depend on the range between beginning and end.

Test.xlsx
GDGEGFGGGHGIGJGK
42Select BeginningDec-2417
43Select EndJan-2518
44
45
46CategorySubDec-24Jan-25Feb-25
47HousingRent-8,780-8,780-8,780
48HousingElectricity-118-214-337
49HousingGas0-2470
50HousingWater-92-227-115
51HousingComms-346-346-346
52HousingPay TV-54-54-35
53HousingInsurance-12-12-12
54FoodSupermarket-1,940-2,410-2,410
55FoodHarris Farm-35300
56FoodOther000
57FoodCoffee-102-102-102
58FoodPet Food-70-257-257
59FoodKmart-11300
60HealthHealth Insurance-312-811-811
61HealthFitness-227-227-227
62HealthMedical-328-465-200
63HealthPharmacy0-4000
64HealthVet00-300
65EducationSchool Fees000
66EducationBJJ-410-410-410
67EducationMuay Thai-26000
68EducationOther000
69CarLease-13,4140-2,267
70CarFuel-843-771-771
71CarRegistration00-1,183
72CarRepairs000
73CarOther-20-134-1,200
74…........
75
76Desired Result
77CategoryDec-24Jan-25Feb-25SumAveragePercent of
78Housing-9,402-9,880-9,624-28,907-9,63646%
79Food-2,578-2,769-2,769-8,116-2,70513%
80Health-867-1,903-1,538-4,308-1,4367%
81Education-670-410-410-1,489-4962%
82Car-14,277-905-5,421-20,603-6,86832%
83Subtotal-27,794-15,866-19,762-63,422-21,141100%
CashFlow
Cell Formulas
RangeFormula
GF78:GH78GF78=SUM(GF47:GF53)
GI78:GI82GI78=SUM(GF78:GH78)
GJ78:GJ82GJ78=AVERAGE(GF78:GH78)
GK78:GK82GK78=PERCENTOF(GF78:GH78,$GF$78:$GH$82)
GF79:GH79GF79=SUM(GF54:GF59)
GF80:GH80GF80=SUM(GF60:GF64)
GF81:GH81GF81=SUM(GF65:GF68)
GF82:GH82GF82=SUM(GF69:GF73)
GF83:GK83GF83=SUM(GF78:GF82)



Thanks to everyone for any help.

Cheers H
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
How about
Fluff.xlsm
GDGEGFGGGHGIGJGKGLGMGN
42Select Beginning01/12/202417
43Select End01/02/202518
44
45
46CategorySub01/09/202401/10/202401/11/202401/12/202401/01/202501/02/202501/03/202501/04/202501/05/2025
47HousingRent597-55799-8,780-8,780-8,78020-40419
48HousingElectricity743865702-118-214-33727578211
49HousingGas232276840-24702614886
50HousingWater402534698-92-227-1158418083
51HousingComms68828-5-346-346-34633847209
52HousingPay TV73692653-54-54-3516096910
53HousingInsurance488200476-12-12-12-1527155
54FoodSupermarket402317441-1,940-2,410-2,410295590800
55FoodHarris Farm473459399-35300854795784
56FoodOther2461,000418000955654928
57FoodCoffee291691819-102-102-102715131619
58FoodPet Food801-17510-70-257-257852977187
59FoodKmart-883740-11300751498753
60HealthHealth Insurance174-38533-312-811-811720877458
61HealthFitness-58-926-227-227-227646763615
62HealthMedical84173364-328-465-200234924225
63HealthPharmacy5084135840-4000101149-18
64HealthVet-7219033800-300557-19344
65EducationSchool Fees-57993936000733452182
66EducationBJJ837514651-410-410-410855849727
67EducationMuay Thai733187962-26000749321785
68EducationOther612265675000717884832
69CarLease38581657-13,4140-2,267563530858
70CarFuel691699205-843-771-771917-40433
71CarRegistration75010996500-1,183823907274
72CarRepairs248-2635300089472818
73CarOther33174203-20-134-1,200935135132
74…........
75
76Desired Result
77Category01/12/202401/01/202501/02/2025SumAveragePercent of
78Car-14,277-905-5,421-20,603-6,86832%
79Education-670-410-410-1,489-4962%
80Food-2,578-2,769-2,769-8,116-2,70513%
81Health-867-1,903-1,538-4,308-1,4367%
82Housing-9,402-9,880-9,624-28,907-9,63646%
83Total-27,794-15,866-19,762-63,422-21,141100%
Data
Cell Formulas
RangeFormula
GE77:GK83GE77=LET(g,GROUPBY(GD46:GD73,FILTER(GF46:GN73,(GF46:GN46>=GE42)*(GF46:GN46<=GE43)),SUM,3),d,DROP(DROP(g,1),-1),s,BYROW(d,SUM),ss,SUM(s),a,BYROW(d,AVERAGE),p,MAP(s,LAMBDA(m,m/ss)),HSTACK(g,VSTACK("Sum",s,ss),VSTACK("Average",a,SUM(a)),VSTACK("Percent of",p,SUM(p))))
Dynamic array formulas.
 
Upvote 0
@Fluff, thank you so much for your help. This works great but the problem I'm facing is, that if I adapt this to the real table I created, it always gives me #Value! or #Calc!.

My table is: A46:EA95 (first row header names)
Category to filter: A46:A95 (Tbl_expenses[ExpenseCategory]
Month: C46:EA46 (col A and B are Expenses Category and Expense Sub

=LET(
g,GROUPBY(Tbl_expenses[ExpenseCategory],FILTER(Tbl_expenses,(GF46:GN46>=GE42)*(GF46:GN46<=GE43)),SUM,3),
d,DROP(DROP(g,1),-1),
s,BYROW(d,SUM),
ss,SUM(s),
a,BYROW(d,AVERAGE),
p,MAP(s,LAMBDA(m,m/ss)),
HSTACK(g,VSTACK("Sum",s,ss),
VSTACK("Average",a,SUM(a)),
VSTACK("Percent of",p,SUM(p)))
)

In the above I have not yet changed (GF46:GN46>=GE42)*(GF46:GN46<=GE43)), as I already got an error message....

Thanks very any further help.

@alansidman, learning that will have to wait for another date, but thank you for outlining another approach.
 
Upvote 0
@Fluff, I got it working. I made a mistake in defining the correct array. If I could ask one more questions please:
1. currently the data is sorted alphabetically by the category (col A). How do I adjust the function to sort from largest spend to lowest spend in the Sum or Percent of column?


Thank you so much.
 
Upvote 0
How about
Excel Formula:
=LET(g,GROUPBY(GD46:GD73,FILTER(GF46:GN73,(GF46:GN46>=GE42)*(GF46:GN46<=GE43)),SUM,3),d,DROP(DROP(g,1),-1),s,BYROW(d,SUM),ss,SUM(s),a,BYROW(d,AVERAGE),p,MAP(s,LAMBDA(m,m/ss)),SORTBY(HSTACK(g,VSTACK("Sum",s,ss),VSTACK("Average",a,SUM(a)),VSTACK("Percent of",p,SUM(p))),VSTACK(2,p,-1),-1))
 
Upvote 0
Solution
How about
Excel Formula:
=LET(g,GROUPBY(GD46:GD73,FILTER(GF46:GN73,(GF46:GN46>=GE42)*(GF46:GN46<=GE43)),SUM,3),d,DROP(DROP(g,1),-1),s,BYROW(d,SUM),ss,SUM(s),a,BYROW(d,AVERAGE),p,MAP(s,LAMBDA(m,m/ss)),SORTBY(HSTACK(g,VSTACK("Sum",s,ss),VSTACK("Average",a,SUM(a)),VSTACK("Percent of",p,SUM(p))),VSTACK(2,p,-1),-1))
Awesome and thank you so much. There is still so much to learn.....😉
 
Upvote 0

Forum statistics

Threads
1,226,013
Messages
6,188,421
Members
453,473
Latest member
bbugs73

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