Retrieve unique items array

L

Legacy 143009

Guest
Hi,

There are formulas already to extract unique items from a range but all of them are based/depends on comparing the list column reference by COUNTIF.

Is there anyway to retrieve a unique array alone, for example may work in TEXTJOIN function?


E.g. TEXTJOIN(", ",0,UNIQUEFUNCTION)

Thanks a lot!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Suggesting TEXTJOIN indicates that you may want all the unique items listed in a single cell. Is that your requirement? Or are you looking for ways to list them down a column?
Is the original list in separate cells a column?
 
Upvote 0
As I mentioned in my post, listing to a seperate column depends on the listed column reference.

TEXTJOIN is not important. It was just an example. Theoretically I want to have {"uniqueItem1", "uniqueItem2", "uniqueItem3"} array in the end.
 
Upvote 0
Not sure what you want

See if this example helps

Data

[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Names​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
Anthony​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
Bob​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
Mary​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
Mike​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
Robert​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
Anthony​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
Robert​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
Bob​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
Mary​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
11
[/td][td]
Mary​
[/td][/tr]
[/table]


Paste this formula in the Formula Bar and press F9
=IF(FREQUENCY(MATCH(A2:A11,A2:A11,0),ROW(A2:A11)-ROW(A2)+1),A2:A11,"")

You see...
={"Anthony";"Bob";"Mary";"Mike";"Robert";"";"";"";"";"";""}

M.
 
Upvote 0
Control+shift+enter, not just enter:

=IF(FREQUENCY(IF(1-(range=""),MATCH(range,range,0)),ROW(range)-ROW(INDEX(range,1,1))+1),range)

would deliver an array of unique items from range along with a bunch of FALSE values. This can be processed by feeding to relevant functions.
 
Upvote 0
@Marcelo Branco, your solution is what I need. Thank you very much. It also produces empty array elements but not a big deal. Also it doesn't require Ctrl+Shift+Enter.
TEXTJOIN with ignoring empty values, the result is: Anthony, Bob, Mary, Mike, Robert. (What I need!)
TEXTJOIN without ignoring empty values, the result is: Anthony, Bob, Mary, Mike, Robert, , , , , , .
In fact your actual array is: {"Anthony", "Bob", "Mary", "Mike", "Robert", "", "", "", "", ""}
Thanks a lot again!

@Aladin Akyurek your solution is a bit tricky. It is also an array formula.
TEXTJOIN with ignoring empty values, the result is: Anthony, Bob, Mary, Mike, Robert, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE.Also the same result in TEXTJOIN without ignoring empty values.

Both thanks a lot for your great effert!
 
Upvote 0
@Marcelo Branco, your solution is what I need. Thank you very much. It also produces empty array elements but not a big deal. Also it doesn't require Ctrl+Shift+Enter.
TEXTJOIN with ignoring empty values, the result is: Anthony, Bob, Mary, Mike, Robert. (What I need!)
TEXTJOIN without ignoring empty values, the result is: Anthony, Bob, Mary, Mike, Robert, , , , , , .
In fact your actual array is: {"Anthony", "Bob", "Mary", "Mike", "Robert", "", "", "", "", ""}
Thanks a lot again!

@Aladin Akyurek your solution is a bit tricky. It is also an array formula.
TEXTJOIN with ignoring empty values, the result is: Anthony, Bob, Mary, Mike, Robert, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE.Also the same result in TEXTJOIN without ignoring empty values.

Both thanks a lot for your great effert!

It's the same thing... Additionally, it doesn't include an empty/blank cell as an unique item.
 
Upvote 0
It's the same thing... Additionally, it doesn't include an empty/blank cell as an unique item.
After thinking for a while, I think you are right. Omitting empty/blank cells thumbs up (y)
Also returning pure FALSE values will be absolutely beneficial to evaluate them in other functions.

You are very very right Sir!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
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