Home > Back-end >  How to get unique values in a column, including cells with multiple values seperated by commas, in G
How to get unique values in a column, including cells with multiple values seperated by commas, in G

Time:06-15

I have a column in a Google Sheet, which in some cases, includes multiple values separated by commas — like this:

Value
A
B
C
D
A, E
A, F
G, D, C

I would like to count all occurrences of the unique values in this column, so the count should look like:

Unique value Occurrences
A 3
B 1
C 2
D 2
E 1
F 1
G 1

Currently, however, when I use =UNIQUE(A2:A), the result gives this:

Unique value Occurrences
A 1
B 1
C 1
D 1
A, E 1
A, F 1
G, D, C 1

Is there a way I can count all of the instances of letters, whether they appear in individually in a cell or appear alongside other letters in a cell (comma-seperated)?

(This looks like a useful answer enter image description here

Formula in C1:

=INDEX(QUERY(IFERROR(FLATTEN(SPLIT(A1:A,", ")),""),"Select Col1, count(Col1) where Col1 is not null group by Col1 label count(Col1) ''"))
  • Related