I have a spreadsheet laid out with three columns (a,b,c) as such:a       b       c    --      --      --abc     12      yesabc     8       yesxyz     10      noxyz     5       nolmn     8       yesWhat I am trying to do is write a query to output with three columns: a, sum(b). Then I want to add in a 3rd column that is sum(c) where c='yes' and only this column has this filter. All Should be grouped on column a. So my result should look like this:a       b       c    --      --      --abc     20      20xyz     15      0lmn     8       8Getting columns a and b as I want them is easy but I don't know how to get column C given just that column has the criteria to sum only if column C = 'yes'. How do I add the last column to this query to produce column C results:=QUERY('Raw Data'!A2:C, Select A, Sum(B) group by A)Any ideas?
Google Sheets Query sum single column based on criteria
google spreadsheets;google spreadsheets query
I was able to come up with the answer:=query({A2:B,ArrayFormula(if(C2:C=yes, B2:B,0))}, select Col1, sum(Col2), sum(Col3) where Col1 <>'' group by Col1 label sum(Col2)'', sum(Col3)'', 0)