1

I'm new to query and can't figure out how to get grouped results of sum in two columns.
dataset
There's data set in the picture of names and points which are in two columns and query formula to sum and group the results for first two columns.

=QUERY(AF2:AJ34; "select AG, sum(AH) 
where AG is not null 
group by AG
order by sum(AH) desc
label AG 'Name', sum(AH) 'Points'")

How can I get the same result but from both columns of points?

0

1 Answer 1

2

Maybe you can create a two-columns range with curly brackets, by stacking those two columns: {AG2:AH;AI2:AJ}

=QUERY({AG2:AH;AI2:AJ}; "select Col1, sum(Col2) where Col1 is not null group by Col1 order by sum(Col2) desc label Col1 'Name', sum(Col2) 'Points'")

(PS: you could also use VSTACK instead of curly brackets)

2

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