Need help with TEXTJOIN for Unique Values

skushner

New Member
Joined
Feb 15, 2019
Messages
3
Need some help changing the following formula to only grab unique values:

{=TEXTJOIN(",",TRUE,IF($A$2:$A$20000=A2,$C$2:$C$20000,""))}

Here's an example of the data (the last column is where this formula goes for each row:

[TABLE="width: 612"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Part Number[/TD]
[TD]Project[/TD]
[TD]Project Parent[/TD]
[TD]TEXTJOIN[/TD]
[/TR]
[TR]
[TD]961344[/TD]
[TD]W13-1 [/TD]
[TD]W13[/TD]
[TD]W13[/TD]
[/TR]
[TR]
[TD]1001156[/TD]
[TD]A36-1 [/TD]
[TD]A36[/TD]
[TD]A36,A36[/TD]
[/TR]
[TR]
[TD]1001156[/TD]
[TD]A36-2 [/TD]
[TD]A36[/TD]
[TD]A36,A36[/TD]
[/TR]
[TR]
[TD]1001521[/TD]
[TD]P21-1 [/TD]
[TD]P21[/TD]
[TD]P21,P21[/TD]
[/TR]
[TR]
[TD]1001521[/TD]
[TD]P21-2 [/TD]
[TD]P21[/TD]
[TD]P21,P21[/TD]
[/TR]
[TR]
[TD]1023070[/TD]
[TD]A32-3 [/TD]
[TD]A32[/TD]
[TD]A32,L11,L20,L8[/TD]
[/TR]
[TR]
[TD]1023070[/TD]
[TD]L11-1[/TD]
[TD]L11[/TD]
[TD]A32,L11,L20,L8[/TD]
[/TR]
[TR]
[TD]1023070[/TD]
[TD]L20-1[/TD]
[TD]L20[/TD]
[TD]A32,L11,L20,L8[/TD]
[/TR]
[TR]
[TD]1023070[/TD]
[TD]L8-1 [/TD]
[TD]L8[/TD]
[TD]A32,L11,L20,L8[/TD]
[/TR]
[TR]
[TD]1023435[/TD]
[TD]L17-1 [/TD]
[TD]L17[/TD]
[TD]L17,L17[/TD]
[/TR]
[TR]
[TD]1023435[/TD]
[TD]L17-2[/TD]
[TD]L17[/TD]
[TD]L17,L17[/TD]
[/TR]
</tbody>[/TABLE]


I'm trying to get rid of the bolded instances where it shows the same project parent twice (like P21, P21) and only show it once so each value after the comma is unique.
I really don't want to use VBA for this because it will be an ongoing report so i'd rather use formulas that I can copy/paste if possible.

If someone could help me with this i'd really appreciate it!!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try...

Code:
D2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=TEXTJOIN(",",TRUE,IF(FREQUENCY(IF($A$2:$A$12=A2,MATCH(IF($A$2:$A$12=A2,$C$2:$C$12),IF($A$2:$A$12=A2,$C$2:$C$12),0)),ROW($A$2:$A$12)-ROW($A$2)+1)>0,$C$2:$C$12,""))

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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