Consulting

Results 1 to 3 of 3

Thread: Sleeper: Conditional cumulative sum

  1. #1

    Sleeper: Conditional cumulative sum

    I am completely new to VBA, and I have limit expertise in Excel. So I need help!!!

    I have three columns the first two are zones (integers), and the third is the value I want to cumulatively sum.

    This are the first few values:
    zoneA zoneB Values
    row1 1 2 55
    row2 1 2 13
    row3 1 3 11
    row4 1 4 2
    row5 1 4 12

    What I need, is to to sum the values of the third column (values) when the values of the first two columns (zone A, zone B) are the same. In the example, the results should be:

    1 2 68
    1 3 11
    1 4 14

    I need it to be presented in an excel worksheet as a result.

    Thanks!!

  2. #2
    Try
    =SUMPRODUCT(($A$2:$A$6=1)*($B$2:$B$6=2)*($C$2:$C$6))    =68
           =SUMPRODUCT(($A$2:$A$6=1)*($B$2:$B$6=3)*($C$2:$C$6))    =11
           =SUMPRODUCT(($A$2:$A$6=1)*($B$2:$B$6=4)*($C$2:$C$6))    =14
    where 1 is zoneA and 2, 3, 4 is zoneB

  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    why not just, assuming headers are in row 1, data starts in row 2...

    =SUM(C1,IF(A2=B2,C2,0))

Posting Permissions

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