Q:

Inclusion of cells within data range, for AVERAGE function, based on criteria

I am trying to create mean value using the AVERAGE function in google spreadsheets.
However, i have to program my way out of including/excluding specific cells to include in data range for my function.
My data looks similar to this:

                       Q1               Q2
  City 1              1            4
  City 2              2            5
  City 1              3            4

In another sheet i will have to put the mean for the values into a cell, but only for the answers that entail "City 1" so i have to exclude "City 2" from my function. I cannot use the manual data-filtering, as it has to be analysed completely automatic.

A:

Does this formula work as you want on the other sheet:
=AVERAGE(FILTER(Sheet1!B:C,Sheet1!A:A="City 1"))

