Search code examples
google-sheetsgoogle-sheets-formulaspreadsheet

Find count of String in hundred column


I have hundred data in spreadsheet. I want to know the count of that fruit name. How can i do this in Spreadsheet? Example (expected) output:

Banana = 38
Grape = 41
Dates = 29
Orange = 32
..
etc

spreadsheet


Solution

  • QUERY() would be good choice.

    =QUERY(FLATTEN(B2:J),"select Col1, count(Col1) group by Col1 label Col1 'Fruits', count(Col1) 'Count'")
    

    If you want to exclude blank cells then use

    =QUERY(FLATTEN(B2:J),"select Col1, count(Col1) 
    where (Col1 is not null) 
    group by Col1 
    label Col1 'Fruits', count(Col1) 'Count'")
    

    enter image description here