Search code examples
filtergoogle-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Combine rows based on multiple criteria and then sum one column


Group rows together when columns A,B,C,D,F match (D can be blank and still be considered a match) and then sum the "Qty" column.

I can FILTER and I can SUM, but I can't seem to do both.

This formula will be in 'estimate-Tally'!A2

enter image description here


Solution

  • =QUERY(QUERY(A2:X6, 
     "select A,B,C,' ','  ',F,sum(G),H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X 
      where A is not null 
      group by A,B,C,' ','  ',F,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X", 0),
     "offset 1", 0)
    

    0