简体   繁体   English

所有先前行的ArrayFormula和PRODUCT?

[英]ArrayFormula and PRODUCT of all previous rows?

I have a column of percent changes (column A) and want to create a running total percent change (column B):我有一列百分比变化(A 列)并且想要创建一个运行总百分比变化(B 列):

   A        B
-------  -------
100.00%  100.00%
 92.75%   92.75%
 97.23%   90.18%
100.00%   90.18%
100.56%   90.68%

This is easy with a formula in each cell of column B, starting with B1 and copying down:这很容易在 B 列的每个单元格中使用公式,从 B1 开始并向下复制:

=IF(B1="","",PRODUCT(B$1:B1))

However, I would like to change this to an ArrayFormula to avoid the need to continuously copy that formula down the column when rows are added.但是,我想将其更改为 ArrayFormula 以避免在添加行时需要将该公式连续复制到列中。

Is this possible using ArrayFormula?这可以使用 ArrayFormula 吗?

Back to school on this one.回到学校这个。 So you take logs, do a running sum, then antilog:所以你取对数,做一个运行总和,然后是对数:

=ArrayFormula(10^mmult(if(column(indirect("A1:"&address(counta(A:A),counta(A:A))))>row(indirect("A1:"&address(counta(A:A),counta(A:A)))),0,1),log10(indirect("A1:A"&counta(A:A)))))

在此处输入图像描述

I forgot that you don't actually have to create a 2d array to do a running total, so can simplify to我忘了你实际上不必创建一个二维数组来做一个运行总计,所以可以简化为

=ArrayFormula(10^mmult(if(transpose(row((indirect("A1:A"&counta(A:A)))))>
row(indirect("A1:A"&counta(A:A))),0,1),log10(indirect("A1:A"&counta(A:A)))))

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

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