+ Reply to Thread
Results 1 to 5 of 5

Cumulative Sum of values in an array

  1. #1
    Forum Contributor
    Join Date
    04-07-2013
    Location
    France
    MS-Off Ver
    Excel 2011
    Posts
    166

    Cumulative Sum of values in an array

    I'm trying to cumulate the sums of values in an excel column of 4 values dimension (4,1).

    So, I constructed the code below. For the first row in a column on the side Result, it is supposed to hold the same value as in the original Array.
    But then, once it is greater than the first row, it is supposed to get the previous element of result (i-1) and add to it the current column element (i).

    VBA is telling me that the subscript is out of range :/ and I cant figure out why... so I dont even know if my code does what I want.



    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Cumulative Sum of values in an array

    Hi,

    like this?

    Please Login or Register  to view this content.
    Regards

  3. #3
    Forum Contributor
    Join Date
    04-07-2013
    Location
    France
    MS-Off Ver
    Excel 2011
    Posts
    166

    Re: Cumulative Sum of values in an array

    Hmmm, it does work, but it posts the value from the last element in rColumn in all 4 rows of result.. :S

  4. #4
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Cumulative Sum of values in an array

    try one of those:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-07-2013
    Location
    France
    MS-Off Ver
    Excel 2011
    Posts
    166

    Re: Cumulative Sum of values in an array

    It works, thanks for the help!

    Though, I have the question, wouldn't this be possible with the code I wrote originally too? :/ I just can't see where I went wrong with that one..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1