Google-sheets – Google sheets split and unique

google sheets

I have a column and each cell has multiple labels, like so:

a,b,c
b, c, d
g, h, a

So I'm looking for a formula, not code, where the formula finds the unique elements for the column,

output:

a
b
c
d
g
h

I've tried different combinations of unique(), split(), arrayformula(), transpose() but can't get it work.

=unique(ArrayFormula(TRANSPOSE(split(A1:A3,","))))

not sure how to get it into one column

Best Answer

You can use this formula: =unique(transpose(arrayformula(trim(split(join(",",A1:A),",")))))

Assuming that the delimiter is always a comma - the easiest way to stack them would be to use join with the same delimiter as well.

That way when you split it, they will all be split with the same delimiter.

In order to clean up the extra spaces, you want to wrap that in an arrayformula trim around your split formula, and finally transpose the list and wrap with unique.

enter image description here