I want to calculate the average buy price of stocks:
for the average column I have the following formula:
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?
You can use AVERAGEIFS formula for multiple conditions. Just keep in mind that parameter orders are slightly different from AVERAGEIF.
Your usage may be,
=AVERAGEIFS(H:H, C:C, C2, G:G, "Buy")
You can also use the
AVERAGE array function with
Array formula after editing is confirmed by pressing