vba code almost working, just needs one edit to look at one column to left of where it looks

finnstone
finnstone used Ask the Experts™
on
need a code script modified.

you will see in the attached that the formula is summing the wrong columns. it is supposed to look for when the array crosses 215,000 of the sum of the preceding columns, then take the sum of all of the next columns . for some reason it starts an n+1, n+2 instead of summing n,n+1,n+2...i.e. it skips the cell immediately following the cell where threshold was crossed.
RunningSumTestingQ29115305-SUMMING-.xlsm
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mechanical Engineer
Most Valuable Expert 2013
Top Expert 2013
Commented:
I don't believe the code needs to be modified. As written, it allows you to specify whether to include the pivot cell or not.
byundtMechanical Engineer
Most Valuable Expert 2013
Top Expert 2013

Commented:
Look at formula for cell G34 in the attached workbook.
=RunningSum(H34:CA34,12,12,215000,2)            'Sums K34:N34
=RunningSum(H34:CA34,12,12,215000,1)                 'Sums J34:N34

Open in new window

The only difference between these two formulas is value of last parameter.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial