# How can I do an aggregate function with multiple columns with a Google Sheets query?

I've got two columns of 10 numbers in Google Sheets. I'd like to average the numbers in both columns using a Google Sheets query. Something like this:

``````=query(A1:B11, "select avg(A&B)", 1)  <- This does NOT work
``````

What DOES work?

• try like this:

``=QUERY(A1:B11, "select avg(A),avg(B)", 1)``

• to kill labels you can do:

``=QUERY(A1:B11, "select avg(A),avg(B) label avg(A)'',avg(B)''", 1)``

• to get average of two columns do:

``=AVERAGE(A1:B)``

• Thanks for the tip. Unfortunately, it's not quite what I'm after: I would like to end up with a SINGLE number that represents the average of ALL values in BOTH columns A and B. For example, assume column A = 1,2,3 and column B = 10, 11, 12. I'd like a single answer = 6.5.
– Alex
Jun 6 '19 at 8:38
• @Alex answer updated Jun 6 '19 at 9:11
• Thanks for the followup, but this doesn't solve my problem. I know that I can revert to doing the average with AVERAGE or DAVERAGE, but my application is significantly more complex than that. I would REALLY like to figure out how to do the averaging across columns within the Select statement. Or, perhaps it requires nesting Select statements...
– Alex
Jun 7 '19 at 6:52
• can you share a copy of your sheet? or some sample of your data? there are various methods of how this can be solved and we could be guessing whole month what exactly do you need Jun 7 '19 at 7:08
• Here's an example: Column A has values 1,2,10 Column B has values 17, 95, 1000, 2000 I'd like a select statement that averages all 7 values i.e. that provides the same result as average(1,2,10,17,95,1000,2000) which is 446.43. I hope that's helpful. Thanks! Alex
– Alex
Jun 8 '19 at 10:46