+ Reply to Thread
Results 1 to 3 of 3

Sum of time for consecutive positive/ negative numbers

  1. #1
    Registered User
    Join Date
    12-07-2012
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    43

    Exclamation Sum of time for consecutive positive/ negative numbers

    I have 2 columns with rows running upto 80000 at times.

    ColumnA: Time1-Time0 (in 00:00:00 format) | ColumnB: Price1-Price0


    I want a formula in 3 different cells to find,
    1. Sum of time for Maximum consecutive positive prices (without a negative price in between, but zero included)
    2. Sum of time for Maximum consecutive negative prices (without a positive price in between, but zero included)
    3. Sum of time for Maximum consecutive 0 prices (without positive or negative price in between)

    I tried doing this using 3-4 helper columns with long formula's but that's making my excel hang and takes 10mins to process each column!!

    Hence can someone please help me with a combination of formula's so I cant enter them in 3 separate cells and just get the time.

    This is a little urgent, so will be really grateful if someone can come up with a solution soon.


    Many thanks,
    Dex

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Sum of time for consecutive positive/ negative numbers

    Hi Dex,

    Suggest you to upload a sample workbook highlighting your expected output. Thanks.

    Regards,

    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

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

    Re: Sum of time for consecutive positive/ negative numbers

    Dex, given urgency I suspect you have resolved elsewhere ?

    You could probably do without helpers c/o a complex Frequency array, however, helpers are never a bad thing in my opinion.

    What's not clear is what happens when you have >1 streaks of same longevity - presumably you would want to take the max duration of the various streaks ?

    Below seems a little long winded but all formulae are efficient (no arrays, no volatiles etc) so performance should be good.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    at which point

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    to reiterate - you could do the same with far fewer formulas than the above but if performance is of paramount concern then the above might be worthy of consideration.
    Last edited by DonkeyOte; 12-25-2012 at 04:10 AM.

+ 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