Google Sheets - Count number of occurences of word BEFORE comma

221 views Asked by At

I'm trying to count the number of times specific words, names in this case, occurs in a column. However, there may be any number of names in each cell in that column, and I'm only interested in the first one in each.

If there is more than one name in a cell, each of them is separated by a comma, and I'm hoping to use that in some way to ignore the names I don't want. It's very much like this question, the only difference is discarding everything after a comma.

Is there a way to do this in Sheets?

1

There are 1 answers

2
Chris Hick On BEST ANSWER

Does this formula work as you want (assuming your list of names is in the range A2:A):

=QUERY({ArrayFormula(IFERROR(LEFT(A2:A,SEARCH(",",A2:A)-1),A2:A)),A2:A},"select Col1, count(Col2) where Col1 <> '' group by Col1 label Col1 'Name'")