• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sum until specific criterion is met

AIS

New Member
Hello,
I was looking for a formula which will stop the SUM operation as soon as it finds the value in the column.
TotalPassFail
36351
58571
32341
59581
42411
77752
44440
53521
57552
52502
54531
49481

Here the summation will stop when in Fail column will finds 0 like the orange marked regardless of the values afterward. Here the Total sum will be 7 instead of 14 because of the 0.
 
You could use the fact that INDEX/MATCH returns a cell reference to build the range you wish to sum.
= IFERROR( SUM( start : INDEX( fail, MATCH( 0, fail, 0 ) ) ), SUM(fail) )
where 'fail' is the column and 'start' is the top cell. The error traps the #N/A that results from having no '0's in which case the formula returns the column SUM.
 
Back
Top