Search code examples
google-sheets

list all unique values and count how many times each appears


A spreadsheet contains multiple rows and columns with names (in varying order), the same name can appear in multiple places, but not necessarily in the same column or row. Looking to list all names and count the number of times each name appears (no duplicates).

Tried the UNIQUE in combination with COUNTIF, but I can't seem to make them work together. :( I'm sure there's some way of nesting formulas to tabulate the results, but I just can't wrap my head around it.


Solution

  • You can select your whole range in a query like this (change A2:F with your desired range)

    =QUERY(FLATTEN(A2:F),"SELECT Col1,COUNT(Col1) where Col1 is not null group by Col1")
    

    enter image description here