1

I have this query

=QUERY({'2008'!A2:A500;'2009'!A2:A500;'2010'!A2:A500;'2011'!A2:A500;'2012'!A2:A500;'2013'!A2:A1000;'2014'!A2:A1000;'2015'!A2:A1000;'2016'!A2:A1000;'2017'!A2:A1000;'2018'!A2:A1000;'2019'!A2:A1000;'2020'!A2:A1000},"select Col1, count(Col1) where Col1 != '' group by Col1 label Col1 'Name', count(Col1) 'Count'")

It pulls results from numerous tabs and tells me how many times the same title appears across the years. But it displays it alphabetically by name. Like this:

A 1
B 4
C 2
D 5

I want it to display using the count result in descending order.

D 5 
B 4 
C 2 
A 1 

Everything I try results in an error, and the basic sort by column B instantly reverts back to the original view.

3
  • did you try "order by Count desc"? – Dave Dec 27 '20 at 16:38
  • Hi, Thanks. I'm still getting a parse error, so I must be doing something wrong, When you get a chance could clarify where that should go in the query? – Colin Woodward Dec 27 '20 at 17:21
  • first of all, not sure why there are quotation marks after 'where Col1 !=' in your formula. that seems to break the formula string. try removing that. – Dave Dec 27 '20 at 18:42
2

The select clause identifies "Col1" and "count(Col1)". So try order by on "count(Col1)":

"select Col1, count(Col1) where Col1 != '' group by Col1 order by count(Col1) label Col1 'Name', count(Col1) 'Count'"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.