View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Matthew Herbert Matthew Herbert is offline
external usenet poster
 
Posts: 56
Default hey guys, thanks for all the help with the loop problem...partdeu

On Jul 24, 4:06*am, Sam wrote:
Hey Guys, need some greater minds than mine to help me out....

so I need it to cumulatively sum the 1's *in column a but the moment there
is a 0 it needs to stop summing.Then once there is a 1, start the process
from 1 again. This is going from the bottom to the top by the way.

* * * * *I NEED THIS
* * * * *COLUMN BELOW
* * * * *(B) BUT CAN'T
* * * * *WORK OUT THE
* * * * RIGHT FORMULA

* * * * * * * * * * * * * * *THIS COLUMN (C)
* * * * * * * * * * * * * * *IS MY FIRST TRY..
* * * * * * * * * * * * * * * BUT CAN'T GET IT
* * * * * * * * * * * * * * *TO RESTART THE
* * * * * * * * * * * * * * * SUM PROPERLY

A * * * * * * *B * * * * * * * *C

1 * * * 4 * * * 13
1 * * * 3 * * * 13
1 * * * 2 * * * 12
1 * * * 1 * * * 11
0 * * * 0 * * * 10
0 * * * 0 * * * 0
0 * * * 0 * * * 0
0 * * * 0 * * * 0
0 * * * 0 * * * 0
0 * * * 0 * * * 0
1 * * * 2 * * * 0
1 * * * 1 * * * 9
0 * * * 0 * * * 8
0 * * * 0 * * * 0
1 * * * 2 * * * 0
1 * * * 1 * * * 7
0 * * * 0 * * * 6
0 * * * 0 * * * 0
0 * * * 0 * * * 0
0 * * * 0 * * * 0
1 * * * 6 * * * 0
1 * * * 5 * * * 5
1 * * * 4 * * * 4
1 * * * 3 * * * 3
1 * * * 2 * * * 2
1 * * * 1 * * * IF(B320,SUM(B32:B$32),0)

much appreciated anyone? This could also be in VBA if anyone prefers?


Sam,

Why not use the SUMIF function? And if your column has 1s and 0s only
then simply do a SUM.

=SUMIF(A1:A8,1,A1:A8)

Best,

Matthew Herbert