ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   SumProduct With Multiple criteria (https://www.excelbanter.com/excel-worksheet-functions/73831-sumproduct-multiple-criteria.html)

Tony D

SumProduct With Multiple criteria
 
Hi, trying get sumproduct formula to correctly count positive and negative
p&l if the stock price is =10 and <=20. I have written:
=SUMPRODUCT(--($B$2:$b$6=10),--($b$2:$b$6<=20),--($a$92:$a$60),$a$2:$a$6)
which results in 300, for the negative total I used
=SUMPRODUCT(--($B$2:$b$6=10),--($b$2:$b$6<=20),--($a$92:$a$6<0),$a$2:$a$6)
which gives me -370. But I need to count? Thanks

P&L Price
(120) 10
300 12
(100) 14
(150) 15
30 25
200 26


bpeltzer

SumProduct With Multiple criteria
 
Just take out the last array argument to the sumproduct function:
=SUMPRODUCT(--($B$2:$b$6=10),--($b$2:$b$6<=20),--($a$2:$a$60))
and =SUMPRODUCT(--($B$2:$b$6=10),--($b$2:$b$6<=20),--($a$2:$a$6<0))


"Tony D" wrote:

Hi, trying get sumproduct formula to correctly count positive and negative
p&l if the stock price is =10 and <=20. I have written:
=SUMPRODUCT(--($B$2:$b$6=10),--($b$2:$b$6<=20),--($a$92:$a$60),$a$2:$a$6)
which results in 300, for the negative total I used
=SUMPRODUCT(--($B$2:$b$6=10),--($b$2:$b$6<=20),--($a$92:$a$6<0),$a$2:$a$6)
which gives me -370. But I need to count? Thanks

P&L Price
(120) 10
300 12
(100) 14
(150) 15
30 25
200 26



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

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