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?


Sheet2 Screenshot:

  • 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


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():

  "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.