As the title says - I have a table which calculates the average of some buys and the number of units bought.

647 represents the sum of those entries, without adding the positions sold. But if I sell something, I need to subtract the qty from the sum, not adding it is not enough.

How can I subtract the ones with sell?

The current formula for that cell is

=SUMIF(O3:O13, "BUY", K3:K13)

but as I said, I need to subtract what was sold.

How should I edit my formula accordingly?


1 Answer 1


now just subtract another SUMIF:

=SUMIF(O3:O13, "BUY", K3:K13)-SUMIF(O3:O13, "SELL", K3:K13)
  • I have no idea how I didn't think about this. It was such an obvious answer lol. Thanks, I will accept your answer asap :) Jan 14, 2021 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.