ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   need help summing product of two arrays (https://www.excelbanter.com/excel-discussion-misc-queries/179049-need-help-summing-product-two-arrays.html)

RL

need help summing product of two arrays
 
Can anyone show me a formula to sum a product of two arrays only when there
is a match. Suppose I want to add up the product of A and C for Apple
(answer 3%) and Orange (answer 3.5%)

eg.
A B C
1% Apple 100%
2% Orange 50%
3% Pear 25%
4% Apple 50%
5% Orange 50%



Bob Phillips

need help summing product of two arrays
 
=SUMPRODUCT(--($B$1:$B$5="Apple"),$A$1:$A$5,$C$1:$C$5)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"rl" wrote in message
...
Can anyone show me a formula to sum a product of two arrays only when
there
is a match. Suppose I want to add up the product of A and C for Apple
(answer 3%) and Orange (answer 3.5%)

eg.
A B C
1% Apple 100%
2% Orange 50%
3% Pear 25%
4% Apple 50%
5% Orange 50%





Tyro[_2_]

need help summing product of two arrays
 
Assuming your data is in rows 1:5 then
=SUMPRODUCT((B1:B5="apple")*A1:A5*C1:C5) produces 3% and
=SUMPRODUCT((B1:B5="orange")*A1:A5*C1:C5) produces 3.5% in cells formatted
as percents with 1 place of decimal. Also
=SUMPRODUCT((B1:B5={"apple","orange"})*A1:A5*C1:C5 ) produces 6.5% in a cell
formatted as percent with 1 place of decimal. You might want to increase the
decimal places to 2.

Tyro

"rl" wrote in message
...
Can anyone show me a formula to sum a product of two arrays only when
there
is a match. Suppose I want to add up the product of A and C for Apple
(answer 3%) and Orange (answer 3.5%)

eg.
A B C
1% Apple 100%
2% Orange 50%
3% Pear 25%
4% Apple 50%
5% Orange 50%






All times are GMT +1. The time now is 03:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com