+ Reply to Thread
Results 1 to 4 of 4

Conditional Sums

  1. #1
    Registered User
    Join Date
    11-17-2010
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    3

    Conditional Sums

    I have a spreadsheet that represents stock daily data and associated trades in rows. As with all trading, some trades are winners and some losers and on some days, there are no trades, as represented by "0". Winners are identified in a column by a "1" and losers by a "-1". I need a formula that will sum the largest number of consecutive winners and losers.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Conditional Sums

    You can use an Array

    Please Login or Register  to view this content.
    Modify ranges as nec. but try to keep as lean as possible

    above assumes 0's (like -1's) stop the winning streak ... for losing streak change references to 1 to -1

  3. #3
    Registered User
    Join Date
    11-17-2010
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Conditional Sums

    What if the column values look something like 1,0,0,1,0,0,1,1? Since the "0" stops the streak this particular formula will not work.

    Thanks for the help.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Conditional Sums

    For a data set of:

    1,0,0,1,0,0,1,1
    the prior formula returns 2.

    Quote Originally Posted by pstrickland
    Since the "0" stops the streak this particular formula will not work.
    The above remains unclear... if 0 does not stop the streak then modify accordingly:

    Please Login or Register  to view this content.
    The above would return 8 - if you expect result of 4: ie 0 does not stop streak but does not count towards it, then:

    Please Login or Register  to view this content.

+ 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