Reputation: 73
I am struggling with the logic behind how I would make the second filter an if statement.
Here's the formula.
=sum(filter($C$2:$C$6,$B$2:$B$6=A10,$A$2:$A$6="BUY"))-sum(filter($C$2:$C$6,$B$2:$B$6=A10,$A$2:$A$6="SELL"))
The problem is not all the codes will immediately have a sell therefore there is no sell number to subtract so an error is caused.
Thanks!
Upvotes: 0
Views: 36
Reputation: 36750
You can try SUMIFS()
=SUMIFS($C$2:$C$6,$B$2:$B$6,A10,$A$2:$A$6,"Buy")-SUMIFS($C$2:$C$6,$B$2:$B$6,A10,$A$2:$A$6,"Sell")
Upvotes: 1