1

I want to calculate the average buy price of stocks:

enter image description here

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?

1
  • 1
    Check AverageIFS Commented Feb 8, 2020 at 16:12

2 Answers 2

1

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")
Sign up to request clarification or add additional context in comments.

Comments

1

You can also use the AVERAGE array function with IF included:

{=AVERAGE(IF((C2=C:C)*("Buy"=G:G);H:H))}

Array formula after editing is confirmed by pressing ctrl + shift + enter

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.