Timmy Lee
Timmy Lee

Reputation: 795

Google Sheets Query - Sum of ColX depending on ColY

So I have the following data:

|Country    | Shop    | Qty |
-----------------------------
|Austrailia | Shop 1  | 3
|Austrailia | Shop 2  |
|Austrailia | Shop 3  | 
|Austrailia | Shop 4  | 
|Japan      | Shop 5  | 10
|Japan      | Shop 6  | 1
|Japan      | Shop 7  | 
|Japan      | Shop 8  | 
|Japan      | Shop 9  | 
|Japan      | Shop 10 | 
|Austria    | Shop 11 |
|Belgium    | Shop 12 | 
|Belgium    | Shop 13 | 
|Belgium    | Shop 14 | 45
|Belgium    | Shop 15 | 
|Belgium    | Shop 16 | 
|Belgium    | Shop 17 | 
|Belgium    | Shop 18 | 
|Denmark    | Shop 19 |     
|Finland    | Shop 20 | 2

I want to create another table in a different tab that queries this table and gives me the sum of the different shops qty row, per country. So, for example, it would output the following:

|Country    | Qty
-----------------
|Austrailia | 3
|Japan      | 11
|Austria    | 0
|Belgium    | 45
|Denmark    | 0 
|Finland    | 2

I've been playing around with the QUERY command but can't get it to output what i need :(

Upvotes: 0

Views: 121

Answers (1)

TheMaster
TheMaster

Reputation: 50452

=QUERY(A1:C21,"Select A,sum(C) group by A",1)

Upvotes: 1

Related Questions