【问题标题】:Query with Median and Group by and where google sheets使用 Google 表格查询中位数和分组依据和位置
【发布时间】:2020-07-28 15:32:30
【问题描述】:

我需要得到分组的中位数

我已经对表格的数据进行了分组

From    type                 Weight
A       person-person        4
A       person-person        3
A       person-organization  11
A       person-person        5
A       person-organization  6
B       person-person        2
B       person-organization  3
B       person-organization  7
C       person-person        5
C       person-person        2
C       person-organization  15
S       person-organization  7
S       person-person        4
S       person-person        3

我需要得到按 col A 分组的 Median,其中 Col B = 'person-person'

A   value1
B   value2
C   value3
S   value4

我可以通过以下方式为平均做到这一点:

=QUERY(Connections!A:C,"Select A, Avg(C) where B='person-person' and C is not null group by A",1)

我曾尝试使用Median 函数,但无法按 A 列分组

谷歌表格 https://docs.google.com/spreadsheets/d/1ZPia3LkVg2Pt4YGIH4KtW49G2uElRFcvWLY6LYOQ-Ss/edit?usp=sharing

这样可以得到中位数吗?

谢谢

【问题讨论】:

    标签: google-sheets google-sheets-formula mean google-query-language


    【解决方案1】:

    不幸的是,在 Google 表格中,QUERY(也不是 ARRAYFORMULA)函数根本不支持中位数。


    可拖动的解决方案:

    =MEDIAN(FILTER(C:C, A:A=H2))
    

    【讨论】:

    • 感谢您的回复,是否可以通过手动复制的公式获得此信息?
    猜你喜欢
    • 1970-01-01
    • 2020-04-28
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-11
    相关资源
    最近更新 更多