I want to group and sort a particular data set. I've prepared the data using a QUERY
function and using other functions.
Can I order by sum?
This is an example file I created: order by sum
I want to group and sort a particular data set. I've prepared the data using a QUERY
function and using other functions.
Can I order by sum?
This is an example file I created: order by sum
Another way is from within the query:
=QUERY(Data!A1:B6;"select A, sum(B), count(B) group by A order by sum(B) desc")
The best result would be to use the QUERY
function:
=SORT(QUERY(Data!A1:B6;"select A, sum(B), count(B) group by A");2;FALSE)
Since the sum already has been sorted ascendingly, the FALSE
statement in the formula will sort descending using column 2
.