计数行直到行的总和值大于一个值 [英] Count rows until the sum value of the rows is greater than a value
问题描述
我想计算多少行的和值不大于X。
I want to count how many rows have the sum value no greater than X.
与此相同总结到某一点 - MySql ,但只有一个excel公式,只有行数。
使用与上述相同的示例,第一个限制应该给出值2和第二个4。
Same as this Sum until certain point - MySql but just with an excel formula and only the row count. Using the same examples as in the above, first limit should give the value 2 and the second 4.
推荐答案
添加一个额外的列可以轻松做到。在该列中,您将通过填写一个公式来保持运行总计
It's easy to do by adding an extra column. In that column you would keep a running total by filling down the a formula like this
想象您的数据在第1行中有一个标题行,并且在A1到C6中放置在D2中填写
Imagining your data has a header row in row 1 and is in A1 to C6 put this in D2 and fill down
= SUM($ C $ 2:C2)
=SUM($C$2:C2)
然后在E2中放这个
= COUNTIF(D2:D6,< 500)
=COUNTIF(D2:D6,"<500")
更改数字500将给您一个不同的限制。
Changing the number 500 will give you a different limit.
这篇关于计数行直到行的总和值大于一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!