Google Sheets Icon

How to count the number of phrases or words in a Multiline Cell in Google Sheets

posted in: Technology | 0

Let’s say you have a Google Sheet with Multi Line text like:

And you want to count how many times each phrase is mentioned or the most popular terms.

=query( ArrayFormula(PROPER(flatten(regexreplace(if(len(D2:D),split(D2:D,CHAR(10)),),"\.|\,|\?|;","")))), "select max(Col1), count(Col1) where Col1 <> '' group by Col1 order by count(Col1) desc label max(Col1) 'keyword'")

keywordcount
Jquery569
Google Tag Manager438
Google Font Api273
Bootstrap251
Font Awesome201
WordPress138
Modernizr132
Adobe Experience Manager130
Jquery Ui101
Jquery Migrate95
Drupal93
Slick76
Varnish72
Yoast Seo70
Cart Functionality52
Zurb Foundation50

CHAR(10) is the split the phrases by each new line. aka \n for RegExr’s.

If your cells just have a comma separated list for each row, then swap with ” ,” instead.