Google 工作表:如何找到按另一列值分组的一列值的平均值?

Google Sheets: how to find the average of values in one column grouped by another column's values?

假设我有一个 Google Sheet,其中包含以下数据:

Column1|Column2
A|1
A|2
A|3
A|4
B|1
B|2

并且我想找到 Column2 中的值按 Column1 的值分组的平均值,因此输出如下所示:

A|2.5
B|1.5

我应该看看 query? Or using pivot tables 吗?

转轴 Table

Range: Sheet1!A1:B7

Rows: 
   Group by: Column1

Columns: 
   Group by: Column2

Calculated Field: 
   Forumula: =AVERAGE=(Column2)
   Summarise by: Custom

结果

            1   2   3   4   Grand Total
A           1   2   3   4   2.5
B           1   2           1.5
Grand Total 1   2   3   4   2.166666667

注意:我不知道如何将文本 Grand Total 更改为 Average

这个公式也会给你示例输出:

=QUERY(A:B,"select A,avg(B) where A <> '' group by A label A '', avg(B) ''")