Search code examples
google-sheetscountgoogle-sheets-formulagoogle-sheets-querytextjoin

How do I calculate the total number of times a piece of text occurs in a range in Google Sheets using a formula?


How do I calculate the total number of times a piece of text occurs in a range in Google Sheets using a formula? Link to Google Sheets: https://docs.google.com/spreadsheets/d/161UHaeiMJ_FNdRErgkdnUqEvbBUutqdq1uHat7GjXXA/edit


Solution

  • try:

    =QUERY(FLATTEN(SPLIT(TEXTJOIN(", ", 1, B2:L5), ", ")), 
     "select Col1,count(Col1) 
      where Col1 is not null 
      group by Col1 
      label count(Col1)''")
    

    enter image description here