0

Looking to return average if criteria is met, but I can't get the formula to work when one of my criteria exists in multiple columns. Does anyone have an efficient solution?

=AVERAGEIFS(Sheet2!D:D,Sheet2!A:A,A2,Sheet2!B:C,B2)

Sheet2 Screenshot:

1
  • Welcome! Do you mean something like as =AVERAGE(FILTER(D:D,(A:A=A2)*((B:B=B2)+(C:C=B2))))?
    – JohnSUN
    Dec 17, 2022 at 15:28

1 Answer 1

0

There are many ways to do that. JohnSUN already showed how to do it with filter(). Here's how you would do it with query():

=query( 
  Sheet2!A$1:D, 
  "select avg(D) 
   where A = '" & A2 & "' 
   and(B = '" & B2 & "' or C = '" & B2 & "') 
   label avg(D) '' ", 0 
)

Your Answer

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

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