Table is as follows:

enter image description here

I want calculate the average of values in column C for rows with value "ABC" in column A and value "Yes" in column B.

So, basically, the average of values 2 and 4.


(following OP's request)

To completely skip any header (display nothing instead of some words) please use

=QUERY(A1:C4,"select avg(C) where A='ABC' and B='Yes' label avg(C) '' ")

Please notice the pair of single quotes in the end

You can use this query formula:

=QUERY(A1:C4,"select avg(C) where A='ABC' and B='Yes' label avg(C) 'Average if ABC/Yes' ")

enter image description here

More about QUERY

  • Thank you. Can it output only the avg value and not the "Average if ABC/Yes" label? – Nicolas Hung Jun 18 '20 at 0:27
  • Please see the edited answer.Also, please remember that as per site guidelines when an answer addresses your question, you should accept it and even upvote it so others can benefit as well. – marikamitsos Jun 18 '20 at 1:02
  • Amazing, thank you! – Nicolas Hung Jun 18 '20 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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