Reputation: 11
Suppose I have a column of words, in some cases more than 1 word in each cell, separated by a comma or space. I want to calculate the number of words starting with A, B, C...,Z separately.
Upvotes: 0
Views: 83
Reputation: 1
try:
=ARRAYFORMULA(QUERY(IFERROR(FLATTEN(REGEXEXTRACT(SPLIT(A1:A10; ", "); "^.")));
"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1)''"))
or:
=ARRAYFORMULA(QUERY(IFERROR(UPPER(FLATTEN(REGEXEXTRACT(SPLIT(A1:A10, ", "), "^.")))),
"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1)''"))
Upvotes: 1