No light at my byRow Tunnel

Holger

Board Regular
Joined
Nov 22, 2017
Messages
94
Office Version
  1. 365
Platform
  1. MacOS
Hi,

in a recent post, I asked for help re arrays formulas and searching for matching strings and then apply categories. @Eric W was kind enough to jump on this and provide a solution, that works, which I'm grateful for.

However, as Eric is not on M365 his solution does not use ie byRow and other newer array formulas. So I thought, easy enough to adjust his solution....

And this is, where I'm stuck. I can't seem to get that working.

* I managed to get the search function working to search keyword columns from the mapping table to transaction in the transaction table and if found, return the category from the mapping table
* I also managed to get sumifs working to aggregate results
* I know that byRow can use the above function but I don't get this solved, so I must be making a mistake somewhere



test.xlsx
ZAAABACADAEAF
6Transaction TableMapping Table
7
8TransactionAmountKeywordCategory
9Coles Transaction15ColesColes & Woolworth
10Woolworth Transaction15WoolworthColes & Woolworth
11Harris Farm15HarrisHarris Farm
12Nespresso Transaction15NespressoNespresso
13Nestle Transaction15NestleNespresso
14Petstock15PetPet Food
15Kmart Transaction15KmartKmart, Target, Amazon
16Target Transaction15TargetKmart, Target, Amazon
17Amazon Transaction15AmazonKmart, Target, Amazon
18Nespresso Transaction15StanleyKmart, Target, Amazon
19
20
21
22
23
24
25
26
27SearchbyRow
28Coles & Woolworth#CALC!
29Coles & Woolworth
30Harris Farm
31Nespresso
32Nespresso
33Pet Food
34Kmart, Target, Amazon
35Kmart, Target, Amazon
36Kmart, Target, Amazon
37
38
39
40Sumifs
4115
4215
4315
4430
4515
4615
4715
4815
4915
500
Expenses
Cell Formulas
RangeFormula
Z28:Z37Z28=IF(ISNUMBER(SEARCH(AE9:AE18,"*"&Z9:Z18&"*")),AF9:AF18,"")
AC28AC28=BYROW(AA9:AA18, LAMBDA(row, SUMIFS(row,Z9:Z18,"*"&AE9:AE18&"*")))
Z41:Z50Z41=SUMIFS(AA9:AA18,Z9:Z18,"*"&AE9:AE18&"*")
Dynamic array formulas.


Any help would be great.


Thanks very much
 
Thanks Stephen. The previous thread is resolved. What I'm trying to do is learn and develop solutions by myself, so I was aiming at finding a way to accomplish the same with byRow and Groupby functions etc. as Eric does not have the required Excel version. As I play around and try things mock-up data changes.

The overall aim is to use dynamic array functions. I have meanwhile almost got it solved but stuck with one final problem:

* the transaction and mapping table are only mock-up as the real tables are large
* I now got byRow and GroupBy working to group spend by category and sub. That latest status is in AL28
* The last task is to filter that formula to a date range, form start to end, which is provided in cell AJ3 and AJ4, so that total is 135 (as first transaction is from Dec 2024).

Thanks for your time and sorry, if the learning path creates confusion.


Cheers H


test.xlsx
AIAJAKALAMANAOAPAQ
3Start:1/1/25
4End:1/31/25
5
6
7Transaction TableMapping Table
8DateTransactionAmountKeywordCategorySub
912/12/24Coles Transaction15ColesFoodColes & Woolworth
101/1/25Woolworth Transaction15WoolworthFoodColes & Woolworth
111/15/25Harris Farm15HarrisFoodHarris Farm
121/15/25Nespresso Transaction15NespressoFoodNespresso
131/15/25Nestle Transaction15NestleFoodNespresso
141/15/25Petstock15PetPetPet Food
151/15/25Kmart Transaction15KmartHouseholdKmart, Target, Amazon
161/31/25Target Transaction15TargetHouseholdKmart, Target, Amazon
171/31/25Amazon Transaction15AmazonHouseholdKmart, Target, Amazon
181/31/25Nespresso Transaction15StanleyHouseholdKmart, Target, Amazon
19
20
21
22
23
24
25
26
27byRow
28FoodColes & Woolworth30
29How do I add a filter toFoodHarris Farm15
30groupby to filter onlyFoodNespresso45
31AJ3-AJ4 periodHouseholdKmart, Target, Amazon45
32PetPet Food15
33Total150
Expenses
Cell Formulas
RangeFormula
AL28:AN33AL28=LET( start, AJ3, end,AJ4, k,AO9:AO18, r,BYROW(AO9:AO18,LAMBDA(r,SUMIF(AJ9:AJ18,"*"&r&"*",AK9:AK18))), g,GROUPBY(AP9:AQ18,r,SUM,0,,,), HSTACK(g) )
Dynamic array formulas.
 
Upvote 0
I get it, that you're playing around with the newer functions like BYROW and GROUPBY, so that you can understand and use them.

But I'm just trying to understand your requirements here, which I think are:

- Ignore previous thread.
- Ignore very different layout in Post #1 of this thread.
- Use layout in Post #3, where the results are correct, and just add a date filter?
 
Upvote 0
Thanks for clarifying. How about?

Excel Formula:
=LET(dte,AI9:AI18,t,AJ9:AJ18,amt,AK9:AK18,k,AO9:AO18,cat,AP9:AQ18,start,AJ3,end,AJ4,GROUPBY(cat,BYROW(k,LAMBDA(r,SUM(FILTER(amt,(dte>=start)*(dte<=end)*ISNUMBER(SEARCH(r,t)),0)))),SUM))

But you need to be careful with your keywords. A short keyword like "pet" will match "carpet", "petroleum" etc, and you may get mis-counting or double counting.

EDIT: I see @Eric W already made the same point about "pet" in your other thread!
 
Last edited:
Upvote 0
Solution
If you want the information for each month, you could try Pivotby.
This example uses an actual table and the table includes a Code column.


T202502a.xlsm
JKLM
1
2 24-1225-01Total
3Food156075
4Household6060
5Pet1515
6Total15135150
7
8
6a
Cell Formulas
RangeFormula
J2:M6J2= PIVOTBY(Table3[Category], TEXT(Table3[Date],"yy-mm"), Table3[Amount], SUM)
Dynamic array formulas.
 
Upvote 0
Great minds think alike. I just watched a video last evening at ExcelisFun about pivotby and thought the same so will give that a try over the weekend.

Thanks for the idea.
 
Upvote 0
Thanks for the feedback.
This post includes the source table.

T202502a.xlsm
ABCDE
1
2 24-1225-01Total
3Food156075
4Household6060
5Pet1515
6Total15135150
7
8
9
10
11Transaction Table
12DateTransactionAmountCategory
1312-Dec-24Coles Transaction15Food
141-Jan-25Woolworth Transaction15Food
1515-Jan-25Harris Farm15Food
1615-Jan-25Nespresso Transaction15Food
1715-Jan-25Nestle Transaction15Food
1815-Jan-25Petstock15Pet
1915-Jan-25Kmart Transaction15Household
2031-Jan-25Target Transaction15Household
2131-Jan-25Amazon Transaction15Household
2231-Jan-25Nespresso Transaction15Household
23
6a
Cell Formulas
RangeFormula
B2:E6B2=PIVOTBY(Table3[Category],TEXT(Table3[Date],"yy-mm"),Table3[Amount], SUM)
Dynamic array formulas.
 
Upvote 0

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