简体   繁体   English

Google 表格:水平(行)条件 Arrayformula

[英]Google Sheets : horizontal (row) conditional Arrayformula

I have row 1 containing some dates (undetermined number, because end formula will be a dynamic number) and I want row 5 to display the average of every column that has a date as a header.我的第 1 行包含一些日期(未确定的数字,因为最终公式将是一个动态数字),我希望第 5 行显示日期为 header 的每一列的平均值。

Trying to have this array formula work:试图让这个数组公式起作用:

arrayformula(iferror(
if(B1:1 = "",,
AVERAGE(
indirect(
SUBSTITUTE(ADDRESS(1,COLUMN(B1:1),4),"1","") 
& 7 & ":" & 
SUBSTITUTE(ADDRESS(1,COLUMN(B1:1),4),"1","")
)))))

I think I did isolate the problem in the arrayformula, I can't see where the problem lies with it?我想我确实在 arrayformula 中隔离了问题,我看不出问题出在哪里?

Here's a screenshot:这是一个截图: 在此处输入图像描述

and here's the link to the spreadsheet:这是电子表格的链接:

https://docs.google.com/spreadsheets/d/1GbIWwv0lq6nVdn4dHkSO0-QqZYEPCwJtntCu8wcSd9Q/edit?usp=sharing https://docs.google.com/spreadsheets/d/1GbIWwv0lq6nVdn4dHkSO0-QqZYEPCwJtntCu8wcSd9Q/edit?usp=sharing

QUERY method: QUERY方法:

=ArrayFormula(IF(B1:1="",,IFERROR(VLOOKUP(COLUMN(B1:1),QUERY(SPLIT(FLATTEN(TRANSPOSE(COLUMN(B7:7)&"♦"&B7:1000)),"♦"),"select Col1,avg(Col2) where Col2 is not null group by Col1 label avg(Col2) ''",0),2,FALSE),)))

MMULT method: MMULT方法:

=ArrayFormula(IF(B1:1="",,IFERROR(MMULT(N(TRANSPOSE(ROW(B7:1000)^0)),N(B7:1000))/MMULT(N(TRANSPOSE(ROW(B7:1000)^0)),N(B7:1000<>"")),)))

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

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