-1

In Google Sheet Query, how to compute the value based on criteria of other cells?

enter image description here

Thanks.

player0
  • 124,011
  • 12
  • 67
  • 124
user2988464
  • 3,251
  • 6
  • 21
  • 25

2 Answers2

2

Try the following

=QUERY({A2:D6}, 
"select Col1, Col2, sum(Col3), sum(Col4) where Col1 is not null 
 group by Col1, Col2 
 label sum(Col3) '', sum(Col4) '' ",0)

enter image description here

marikamitsos
  • 10,264
  • 20
  • 26
1

try:

=QUERY(QUERY(A1:D; 
 "select A,B,sum(C),max(D) 
  where A is not null 
  group by A,B");
 "offset 1"; 0)

enter image description here

player0
  • 124,011
  • 12
  • 67
  • 124