I want to calculate the average buy price of stocks:
for the average column I have the following formula: =AVERAGEIF(C:C,C2,H:H)
But that calculates it for all. I'm trying to add a second criteria, I tried
=AVERAGEIF(C:C,C2 AND G2="Buy",H:H)
but it returns an error. How do I chain criterias?

