Google Sheets query - conditional limits for ties? -


i have results of google form in google sheet, , form has participants vote on variety of options. results 1 question following:

 activity ------------- |bowling    | |karaoke    | |karaoke    | |games night| |bowling    | |karaoke    | 

what want have query count votes each option in column, display top result. so, information above, display "karaoke". have query works (below). adapted forum response, i'm not fixed if there's better way it.

=query(index(if({1,0},unique(a2:a12),countif(a2:a12,unique(a2:gx12)))),"select col1, col2 col1<>'' limit 1",0) 

my question is, can use "limit 1" in query show 1 item, if there 2- or 3-way tie top choice? there way can show 1 option if it's max, show 2 if there's 2-way tie max, or 3 if there 3-way tie, etc.?

for example, in data above, show just

|karaoke    | 

but if next person votes bowling, there tie, want show

|karaoke    | |bowling    | 

does make sense? solutions i've found far in sql or postgresql, , don't work in google sheets.

thanks in advance. --eric

try formula:

=query(arrayformula(query(a:a&{"",""},"select col1, count(col2) group col1")),"select col1 col2="&max(countif(a:a,a:a)),0)


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -