How to extract only unique values from TEXTJOIN string?

Jasuan

New Member
Joined
Jan 16, 2014
Messages
34
Office Version
  1. 365
Platform
  1. Windows
Problem: Used textjoin to create tables based on an identifier. Textjoin has now created multiple stings of numbers (i.e. "7, 26" and "7, 37") and I can not figure out which function or combination of functions to use retain only the first unique instance of a number.

I have tried the following formula: =TEXTJOIN(", ",TRUE,IF(I2:I22<>"",IF(MATCH(I2:I22,I2:I22,0)=(ROW(I2:I22)-ROW(I1)),I2:I22,""),""))
However, this returns "7, 26, 7, 37, 7" When I only want "7, 26, 37"
1616915687016.png
 
You can use the sort function, like
Excel Formula:
=TEXTJOIN(", ",1,SORT(UNIQUE(FILTERXML("<p><c>"&SUBSTITUTE(TEXTJOIN(", ",1,I2:I22),",","</c><c>")&"</c></p>","//c"))))
Working..
Now THATS a formula!! never thought to insert "sort" in this manner.
Thank you for the great work you provide
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

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