Count lines until the value of the sum of the lines is greater than the value

I want to count how many rows have a sum value at most X.

Same as Sum up to a point - MySql , but only with excel formula and only number of rows. Using the same examples as above, the first limit should give a value of 2 and the second 4.

-1


a source to share


1 answer


This can be easily done by adding an extra column. In this column, you will save the current amount by filling out the formula as follows

Imagine your data with a header line on line 1 and in A1-C6 put that in D2 and fill in

= SUM ($ C $ 2: C2)



Then in E2 put this

= COUNTIF (D2: D6, "<500")

Changing the number to 500 will give you a different limit.

+2


a source







All Articles