在动态范围内的群集的累积总和

发布于 2025-02-06 00:55:40 字数 198 浏览 2 评论 0原文

我具有动态范围A(a#),我想计算B中每个“子量”的累积总和。结果是列B中的内容。换句话说,我需要一个动态函数/公式,该功能/公式可以识别连续UND中的数字每次都计算他们的总数。

I have the dynamic range A (A#) and I want to calculate the cumulative sum of each "subrange" in B. The result musst be something as shown in column B. In other words I need a dynamic function/ formula which recognises the consecutive numbers in A und computes their total each time.

A is a Dynamic range (A#) containing the input number and B should have the sum of each range containing consecutive numbers (1 or 0)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小女人ら 2025-02-13 00:55:40

我只设法用辅助列C

C1: 1
C2: =IF(A1=A2,C1,C1+1)

C2解决此问题,一直可拖动。在您需要的

B1: =IF(A1=A2,"",SUMIFS(A1,A1,A1))
B2: =IF(A2=A3,"",SUMIFS($A$1:A2,$C$1:C2,C2,$A$1:A2,A2))

,B2一直都可以拖动。

地方 png“ rel =” nofollow noreferrer“>

I only managed to solve this with a helper column C

C1: 1
C2: =IF(A1=A2,C1,C1+1)

C2 is draggable all the way down where you need it

B1: =IF(A1=A2,"",SUMIFS(A1,A1,A1))
B2: =IF(A2=A3,"",SUMIFS($A$1:A2,$C$1:C2,C2,$A$1:A2,A2))

B2 is draggable all the way down where you need it

enter image description here

生生漫 2025-02-13 00:55:40

使用Office 365,您可以使用此功能来创建一个动态数组,如您所示:

=LET( a, A1#,
        sa, SCAN( 0, a, LAMBDA(a,b, a + b ) ),
        rSeq, SEQUENCE( ROWS( a ) ),
        a_1, INDEX( a, rSeq + 1 ),
        change, IFERROR( a_1 <> a, 1 ),
        sChange, SCAN( 0, change*sa, LAMBDA(a,b, MAX( a, b ) ) ),
        IF( change, sChange - IF( rSeq=1, 0, INDEX( sChange, rSeq - 1) ), "" ) )

其中 a1#是输入数组。

With Office 365 you can use this LET to create a dynamic array that spills into Column B as you have shown:

=LET( a, A1#,
        sa, SCAN( 0, a, LAMBDA(a,b, a + b ) ),
        rSeq, SEQUENCE( ROWS( a ) ),
        a_1, INDEX( a, rSeq + 1 ),
        change, IFERROR( a_1 <> a, 1 ),
        sChange, SCAN( 0, change*sa, LAMBDA(a,b, MAX( a, b ) ) ),
        IF( change, sChange - IF( rSeq=1, 0, INDEX( sChange, rSeq - 1) ), "" ) )

where A1# is the input array.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文