Google表格中具有数组公式的滚动计数

问题描述 投票:0回答:1

我有下面的数据集。 Col1是给定的数据,Col2是Col1的前5行(含)的滚动计数。

Date      Col1  Col2
01/04/20  2     1
02/04/20  1     2 
03/04/20  4     3
04/04/20        3
05/04/20        3
06/04/20  5     3
07/04/20  2     3
08/04/20        2
09/04/20        2
10/04/20  1     3
11/04/20        2
12/04/20        1
13/04/20        1
14/04/20        1
15/04/20  1     1

有没有一种方法可以使用arrayformula做到这一点,而不是将计数公式输入到Col2发生故障的每个单元中?

google-sheets count array-formulas
1个回答
0
投票

您可以在行上使用带有条件的Countifs:

=ArrayFormula(filter(countifs(B2:B,">0",row(B2:B),"<="&row(B2:B),row(B2:B),">"&row(B2:B)-5),A2:A<>""))

假设数字为正

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.