How to filter cell for string reoccurrences/duplicates?

My sheet has a cell with content:

Tomato, Potato, Beef, Tomato, Salmon, Beef

I want to remove all reoccurring string elements of this cell so that the new cell shows this:

Tomato, Potato, Beef, Salmon

I've tried to achieve this with the UNIQUE and TEXTJOIN functions so far, without success. Is it possible to apply FILTER to a cell?

Upvotes: 0

Views: 55

Answers (3)

marikamitsos
marikamitsos

Reputation: 10573

This shorter one also works

=JOIN(", ",UNIQUE(TRANSPOSE(SPLIT(A1,", "))))

enter image description here

Upvotes: 0

player0
player0

Reputation: 1

or try:

=INDEX(TEXTJOIN(",", 1, UNIQUE(TRIM(FLATTEN(SPLIT(A1, ","))))

Upvotes: 0

Marios
Marios

Reputation: 27350

Try this:

=TEXTJOIN(", ",true,UNIQUE(TRANSPOSE(SPLIT(substitute(A1," ",),","))))

example

Upvotes: 2

Related Questions