I have a spreadsheet laid out with three columns (a,b,c) as such:
a b c
-- -- --
abc 12 yes
abc 8 yes
xyz 10 no
xyz 5 no
lmn 8 yes
What 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 20
xyz 15 0
lmn 8 8
Getting 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?