I want to write a query that returns the sum of two multiplied cells, where the name is equal to a person's name.  Let's say I  say I have:
| Name | score | days | 
|---|---|---|
| Suzie | 5.0 | 3 | 
| Jonny | 5.0 | 1 | 
| Suzie | 4.0 | 1 | 
| Suzie | 5.0 | 7 | 
| Jonny | 4.0 | 1 | 
basically, I want to know Suzie's average score. Some rows represent multiple days though. The arithmetic would be
(5.0 * 3)
I want to write a query:
=(index(query({a1:c3}, "Select Sum(Col2 * Col3) where Col1 = '" & D22 & "'"),2))
However, it doesn't like the part that says "Sum(Col2 * Col3)"
Is it possible to do the sum of two columns multiplied?
Thank you in advance!
Please see this sample file.
Data
Col1    Col2    Col3
a         10     20
a         30     40
b         10     30
Result
a   1400
b   300
Formula
=QUERY({A2:A,ARRAYFORMULA(B2:B*C2:C)},
"select Col1, sum(Col2) where Col1 <> '' group by Col1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With