Alternative to using Aggregate

rex759

Well-known Member
Joined
Nov 8, 2004
Messages
610
Office Version
  1. 365
Platform
  1. Windows
Hello,
I’ve been using a combination of Index, Aggregate and Countif to show the Nth occurrence, works great.

I was reading about the LAMBDA function and was attempting to build this formula into it. However, I thought it might be easier if I found a shorter option to the Aggregate formula.

The filter formula seems like a good option but I cant get past the spill over. How do I get H6:H14 to populate? Maybe its not meant to work the way I need it to.

Any advice is appreciated

Book1
ABCDEFGH
1Master SheetCategoryIDCategoryID
2a101a101a101
3b102a105a105
4c103a109a109
5d104a113a113
6a105c103c
7b106c107c
8c107c111c
9d108d104d
10a109d108d
11b110b102b
12c111b106b
13d112b110b
14a113b114b
15b114
16c115
17d116
18
Sheet7
Cell Formulas
RangeFormula
H2H2=INDEX(FILTER(B2:B17,A2:A17=G2),)
E2:E14E2=INDEX($B$2:$B$17,AGGREGATE(15,6,(ROW($A$2:$A$17)-ROW($A$2)+1)/($A$2:$A$17=$D2),COUNTIF($D$2:D2,$D2)))
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
工作簿1
ABCDEFG
1Master SheetCategoryID
2a101a101
3b102a105
4c103a109
5d104a113
6a105c103
7b106c107
8c107c111
9d108d104
10a109d108
11b110b102
12c111b106
13d112b110
14a113b114
15b114
16c115
17d116
18
Sheet1
Cell Formulas
RangeFormula
E2:E14E2=MAP(D2:D14,LAMBDA(x,INDEX(FILTER(B2:B17,A2:A17=x),COUNTIF(D2:x,x))))
Dynamic array formulas.
 
Upvote 0
Solution
Try the below:
Book1
ABCDEFGH
1Master SheetCategoryIDCategoryID
2a101a101a101 ,105 ,109 ,113
3b102a105b102 ,106 ,110 ,114
4c103a109c103 ,107 ,111 ,115
5d104a113d104 ,108 ,112 ,116
6a105c103
7b106c107
8c107c111
9d108d104
10a109d108
11b110b102
12c111b106
13d112b110
14a113b114
15b114
16c115
17d116
Sheet1
Cell Formulas
RangeFormula
G2:G5G2=UNIQUE(A2:A17)
H2:H5H2=TEXTJOIN(" ,",,FILTER($B$2:$B$17,$A$2:$A$17=G2))
Dynamic array formulas.
 
Upvote 0
if you need result in post #3, you can also try GROUPBY:
工作簿1
ABCDEFG
1Master SheetCategoryID
2a101a101, 105, 109, 113
3b102b102, 106, 110, 114
4c103c103, 107, 111, 115
5d104d104, 108, 112, 116
6a105
7b106
8c107
9d108
10a109
11b110
12c111
13d112
14a113
15b114
16c115
17d116
18
19
Sheet1
Cell Formulas
RangeFormula
E2:F5E2=GROUPBY(A2:A17,B2:B17,ARRAYTOTEXT,,0)
Dynamic array formulas.
 
Upvote 0
Wow! So many different options. The Map and Byrow are new to me and very cool. I'll keep the other examples as well as I can see future needs for them. Always more to learn with Excel. Thank you very much!
 
Upvote 0
Wow! So many different options. The Map and Byrow are new to me and very cool. I'll keep the other examples as well as I can see future needs for them. Always more to learn with Excel. Thank you very much!
thanks for your feedback :giggle:
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
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