简体   繁体   English

如何使用 Arrayformula 计算具有双重条件的平均值

[英]How to use Arrayformula to calculate the average with a double condition

Link to spreadsheet 链接到电子表格

I have a list of names with a "score" and a code column.我有一个带有“分数”和代码列的名称列表。 I would like to calculate the average of the scores for each name divided by code.我想计算每个名称除以代码的平均分数。 I would like to do it using Arrayformula我想用 Arrayformula 来做

I have tried the following formula but it doesn't expand:我尝试了以下公式,但它没有扩展:

=ArrayFormula(SUMIFS(B:B,A:A,G2:G,C:C,"Z1")/COUNTIF(FILTER(A:C,A:A=G2,C:C="Z1"),G2:G))

I think it's because of SUMIFS but I couldn't find any way to replace it.我认为这是因为 SUMIFS 但我找不到任何方法来替换它。

Thank you谢谢

Aresvik solution works well but I would like to calculate the average only if the scores are typed in. currently, the formula counts also the empty cells. Aresvik 解决方案效果很好,但我只想在输入分数的情况下计算平均值。目前,该公式也计算空单元格。 I tried the following formula but it didn't work我尝试了以下公式,但没有奏效

=ArrayFormula(if(G2:G<>"",iferror(SUMIF(A2:A&C2:C,G2:G&H$1,B2:B)/COUNTIFS(A2:A&C2:C&B:B,G2:G&H$16">0"),),))

Try this in cell H2:在单元格 H2 中试试这个:

=ArrayFormula(if(G2:G<>"",iferror(SUMIF(A2:A&C2:C,G2:G&H$1,B2:B)/COUNTIFS(A2:A&C2:C,G2:G&H$1,B2:B,"<>"),),))

and this in cell I2:这在单元格 I2 中:

=ArrayFormula(if(G2:G<>"",iferror(SUMIF(A2:A&C2:C,G2:G&I$1,B2:B)/COUNTIFS(A2:A&C2:C,G2:G&I$1,B2:B,"<>"),),))

SUMIFS isn't compatible with ARRAYFORMULA . SUMIFSARRAYFORMULA不兼容。

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM