I have this table,

A B C
----------------------
buy 50 apple
buy 130 apple
buy 20 apple
sold 50 apple
sold 25 apple
buy 20 cherry
buy 50 pear
sold 2 cherry
sold 5 cherry

and I filter it by choosing a fruit, for exemple "apple". I want to know how I can get the subtotals ("buy" and "sold") for the chosen fruit and put them on two cells.

the result shoul be like this:

Total "buy" 200
Total "sold" 75

Best Regards
Elio