Search code examples
google-sheetsmatchgoogle-sheets-formulacountinggoogle-sheets-query

Google sheets "MODE" function for non-numeric values


I'm trying to write a Google Sheets function that does the same as the MODE function, but for non-numeric values: returning the most frequently occuring string in a specified range.

I've searched the entire internet, and everywhere it's being suggested to use

=index(G2:L2, match(max(countif(G2:L2; G2:L2)), countif(G2:L2;G2:L2), 0))

or similar. This however returns an #ERROR!, which kind of leads me to believe that the correct syntax must have changed somehow… The range values are not even being highlighted in orange, as it usually does.


Solution

  • try:

    =INDEX(QUERY(A:A, "select A,count(A) group by A order by count(A) desc"), 2, 1)
    

    0