我可以在内部使用带有拆分的arrayformula的arrayformula吗?

时间:2020-08-04 19:29:22

标签: google-sheets split sum average array-formulas

试图用逗号分隔包含“ 198,183,158,315,274”之类的行,然后将它们取平均并除以一个奇数;使用arrayformula。它只会产生一行结果,但是不正确吗?

Here is my test sheet, editable

感谢您的帮助。

2 个答案:

答案 0 :(得分:3)

尝试:

=ARRAYFORMULA({"Average"; IF(A4:A="",,
 IFNA((MMULT(1*IFERROR(SPLIT(INDIRECT("A4:A"&
 MAX(IF(A4:A="",,ROW(A4:A)))), ",")), 
 ROW(INDIRECT("A1:A"&COLUMNS(SPLIT(A4:A, ","))))^0)/
 (1+LEN(REGEXREPLACE(A4:A&"", "[0-9\. ]", ))))/B1))})

0

0


enter image description here

spreadsheet demo

答案 1 :(得分:2)

另一种解决方案:

=ArrayFormula({"Average";(ArrayFormula(mmult(N(array_constrain(ArrayFormula(IFERROR(SPLIT(A4:A8,","))),MATCH(2,1/(A4:A8<>""),1),5)),sequence(Columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)/mmult(N(array_constrain(if(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))>0,1,0),MATCH(2,1/(A4:A8<>""),1),5)),sequence(columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)))/$B$1})

enter image description here