Unique, Textjoin, Filter all in one formula

Georgiboy

Well-known Member
Joined
Nov 7, 2008
Messages
1,501
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

My first thread here i think..

I have been trying to get my head around how to do something with the new 365 functions, below i have used a seperate unique formula to generate a list of unique values from column A and then another formula to then use this unique list to populate a texjoin - filter formula.

Below is the two working together:
Book1
ABCDE
11a1a
22b2b
33c3c, d, e
43d4f, g
53e5h
64f6i
74g
85h
96i
Sheet1
Cell Formulas
RangeFormula
D1:D6D1=UNIQUE(A1:A9)
E1:E6E1=TEXTJOIN(", ",TRUE,FILTER(B1:B9,A1:A9=D1))
Dynamic array formulas.


My question is: Is there a way to combine them both into one spill formula using something like HSTACK?

I want to learn how to use the unique list within the same formula it was created to pull out uniques and then process further with those uniques.

Sorry if this is easy, i have fried my brain today as i usually do everything with VBA but i am trying to broaden my knowledge.

Thanks for any advice offered
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I ahve figured out how to count the duplicates from column B but not to textjoin them.
Lambda-map examples.xlsx
ABCDE
11a11
22b21
33c33
43d41
53e51
64f
75g
8
Sheet2
Cell Formulas
RangeFormula
D1:E5D1=LET(x,UNIQUE(A1:A7),HSTACK(x,MAP(x,LAMBDA(y,IFERROR(ROWS(UNIQUE(FILTER(B1:B7,(A1:A7=y)))),0)))))
Dynamic array formulas.
 
Upvote 0
How about
Excel Formula:
=LET(u,UNIQUE(A1:A9),HSTACK(u,BYROW(u,LAMBDA(br,TEXTJOIN(", ",,FILTER(B1:B100,A1:A100=br))))))
 
Upvote 1
Solution
Here is a link to a post I made a while back. It does show you an alternative using PowerQuery if you want to ever automate this aggregation.
 
Upvote 0
How about
Excel Formula:
=LET(u,UNIQUE(A1:A9),HSTACK(u,BYROW(u,LAMBDA(br,TEXTJOIN(", ",,FILTER(B1:B100,A1:A100=br))))))

Thanks Fluff, this helps with my understanding when joining functions together. This works really well.

I added a filter in with the unique part to prevent the formula from picking up blanks:
Excel Formula:
=LET(u,UNIQUE(FILTER(P2:P12,P2:P12<>"")),HSTACK(u,BYROW(u,LAMBDA(br,TEXTJOIN(", ",,FILTER(Q2:Q12,P2:P12=br))))))

Many thanks for this
 
Upvote 0
Here is a link to a post I made a while back. It does show you an alternative using PowerQuery if you want to ever automate this aggregation.
Hi JvdV,

Thanks for this, i will look into it as i do like PQ. I tend to use it when dealing with larger data sets and importing multiple files from folders.

I was looking for a formula in this instance as it has a very neat use within a dashboard.

Many thanks

George
 
Upvote 0
@Fluff With your formula and a fresh mind i managed to get the formula i was working on to do the same thing, for me though it is not about which formula to use it is about understanding what they are doing enough to trust using them.

Looking at the differences between both of the working formulae' it was only BYROW being swapped for MAP

Excel Formula:
=LET(x,P2:P13,u,UNIQUE(FILTER(x,x<>"")),HSTACK(u,MAP(u,LAMBDA(y,TEXTJOIN(", ",,FILTER(Q2:Q13,(x=y)))))))

Thanks again
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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