+ Reply to Thread
Results 1 to 7 of 7

Find Largest consecutive occurrence of negative values

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2013
    Posts
    4

    Find Largest consecutive occurrence of negative values

    Hi, all

    I've been struggling around this one, might be that my brain is just fried at this point. I already have a formula to help me find the biggest range of consecutive negative values. What I'm looking for now is a formula to find the largest consecutive negative sum value no matter if its got a smaller frequency .

    Let me give you an example to make things a bit clearer, as I might not be explaining myself correctly:

    From the following numbers:
    1400
    -400
    640
    125
    222
    2345
    -2345
    -235

    234
    3456
    -1
    -123
    -1324


    I want to be able to spot the section with the max negative value of -2580 ( -2345 + -235 ) .

    I'm using the following formula to identify the largest range of negative values (-1,-123,-1324) :

    {=MAX(FREQUENCY(IF(H7:H55<0, ROW(H7:H55)), IF(H7:H55>=0, ROW(H7:H55))))} which equals 3 (this is located in Q28)

    & the following to get it to sum that section for me:

    {=SUM(OFFSET(H7,MATCH(Q28,COUNTIF(OFFSET(H7,ROW(INDIRECT("1:"&1+ROWS(H7:H55)-Q28))-1,0,Q28,1),"<0"),0)-1,0,Q28,1))} which then amounts to -1448


    Thus, even if the frequency is less than the max and the total sum of that frequency is the biggest, I want it to list that number or sum value. So even though the set of 2 consecutive negatives ( -2345, -235 ) are less than the 3 consecutive negatives (-1,-123,-1324) in frequency, it's got the highest negative value between the 2.

    The numbers run in a column downwards from H7:H55 . If you want to see the spreadsheet, just let me know.

    Thanks in advance!

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Find Largest consecutive occurrence of negative values

    Edit: deleted by poster.
    Last edited by XOR LX; 08-28-2013 at 11:22 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    08-27-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Find Largest consecutive occurrence of negative values

    Thanks XOR,

    Solved the issue!

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Find Largest consecutive occurrence of negative values

    I hope you weren't using the formula I posted prior to deleting my own thread as it was incorrect (although it may have worked with your particular numbers).

    Regards

  5. #5
    Registered User
    Join Date
    08-27-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Find Largest consecutive occurrence of negative values

    I have actually. Where would it hit problems?

  6. #6
    Registered User
    Join Date
    08-27-2013
    Location
    Cape Town
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Find Largest consecutive occurrence of negative values

    Ok, I just saw what you meant...

  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Find Largest consecutive occurrence of negative values

    It didn't differentiate for strings containing exclusively negative numbers.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Count No. of occurrence of consecutive values
    By rvkadu1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-02-2013, 06:42 AM
  2. Replies: 8
    Last Post: 12-13-2012, 01:15 PM
  3. count the series of consecutive positive/negative values and sum them
    By otage in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-12-2012, 12:43 PM
  4. Replies: 4
    Last Post: 06-14-2012, 06:53 AM
  5. Check for seven or more consecutive negative values?
    By Andersth in forum Excel General
    Replies: 6
    Last Post: 09-13-2010, 08:50 AM

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