本文介绍了行平均数为的数组公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google表格中有一个公式,该公式正在对一行中的值求平均值...

I have a formula in a Google Sheet that is averaging the values in a row...

=AVERAGEIF(A2:L2,"<>0")

简单,对吧?

但是,我不知道如何获得 ARRAYFORMULA 来工作.

However, I cannot figure out how to get the ARRAYFORMULA to work for this.

=ARRAYFORMULA(AVERAGEIF(A2:L,"<>0")

该公式仅对范围内的所有单元进行平均,而不返回每行的平均值.我想念什么?

That formula only averages all of the cells in the range, instead of returning the average for each row. What am I missing?

推荐答案

您已经关闭.尝试:

=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(A2:L),
 "select "&TEXTJOIN(",", 1, IF(LEN(A2:A),
 "avg(Col"&ROW(A2:A)-ROW(A2)+1&")", ))&"")), 
 "select Col2"))

然后添加您需要的<> 0 :

=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(A2:L),
 "select "&TEXTJOIN(",", 1, IF(LEN(A2:A),
 "avg(Col"&ROW(A2:A)-ROW(A2)+1&")", ))&
 "where "&TEXTJOIN(" and ", 1, IF(LEN(A2:A), 
 "not Col"&ROW(A2:A)-ROW(A2)+1&"=0", ))&"")), 
 "select Col2"))

这篇关于行平均数为的数组公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 03:36