+ Reply to Thread
Results 1 to 4 of 4

cummulative sum

Hybrid View

  1. #1
    Registered User
    Join Date
    01-17-2006
    Posts
    5

    cummulative sum

    Hi everyone...

    I need to figure out how to create a new variable that is a cumulative sum of an existing variable with conditions. an example is below where sumnumber is what i am trying to create. any help would be appreciated. thanks.



    subject visit number sumnumber
    1000 1 5 5
    1000 3 6 11
    1000 4 2 13
    1000 7 4 17
    2000 1 0 0
    2000 2 2 2
    2000 3 0 2
    3000 4 5 5
    4000 1 2 2
    4000 4 2 4

  2. #2
    Forum Contributor
    Join Date
    11-29-2005
    Posts
    142
    Try

    =IF(A1=A2,D1+C2,C2) copied down

    Where A1=Subject title, A2=first entry
    C1=Number title, C2=first entry

    And D2 is where you star entering your data.

  3. #3
    Registered User
    Join Date
    01-17-2006
    Posts
    5
    seemed to work pretty good. thanks.

  4. #4
    JE McGimpsey
    Guest

    Re: cummulative sum

    Assuming that subject is sorted as your example shows:

    D2: =C2
    D3: =IF(A3=A2,D2+C3,C3)

    copy D2 down as far as necessary.

    In article <chiapas77.21skoa_1137522910.9832@excelforum-nospam.com>,
    chiapas77 <chiapas77.21skoa_1137522910.9832@excelforum-nospam.com>
    wrote:

    > Hi everyone...
    >
    > I need to figure out how to create a new variable that is a cumulative
    > sum of an existing variable with conditions. an example is below where
    > sumnumber is what i am trying to create. any help would be appreciated.
    > thanks.
    >
    >
    >
    > subject visit number sumnumber
    > 1000 1 5 5
    > 1000 3 6 11
    > 1000 4 2 13
    > 1000 7 4 17
    > 2000 1 0 0
    > 2000 2 2 2
    > 2000 3 0 2
    > 3000 4 5 5
    > 4000 1 2 2
    > 4000 4 2 4


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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