• Heh... "Holy shades of 'Office Space', Batman!"

    I've had some time to do deeper dive on your request and, although I could certainly be wrong, I think there's a fundamental flaw in the logic even in the spreadsheet that would make any accountant worth their salt just absolutely lose it.

    If we look at your spreadsheet...

    ... we see that the "TO" value on row 5 is 60. That means that the total volume for those 3 entries is 60. Yet, the running total in column K, which is based on the value of To-From, is only 59.98. The reason for that is that I don't believe that the FROM values of 10.01 and 20.01 on rows 4 and 5 are correct. Instead, they should be 10.00 and 20.00 as the TO value of the previous rows. A simile of this problem would be that you don't get to add a penny to your checkbook just because you open it the next day. 🙂

    I need you verify that we actually want to make what I believe is an accounting error.

    There's also no way for me to determine what value you want for Column L and it's not included in your data.

    And, yes... we can actually determine the correct volume for each row by using TOn-TO(n-1) but I need to know that's alright as well as have you provide "Column L" data.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)