+ Reply to Thread
Results 1 to 5 of 5

Sum values from maximum consecutive string

  1. #1
    Registered User
    Join Date
    04-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Sum values from maximum consecutive string

    I have a few thousand rows of data. Each row contains a weekly quantity for the last 52 weeks. I have already determined how to find the maximum number of consecutive weeks greater than 0, but need to sum the values associated with the largest consecutive string. I've attached a small subset of the data. In this example, I have the following data:
    A1 B1 C1 D1 E1 F1 G1 H1 I1
    1000 0 0 700 500 500 0 0 200

    I know the max frequency = 3, but I need to sum those 3 data points (700+500+500).

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum values from maximum consecutive string

    Try this array formula**:

    =SUM(OFFSET(INDEX(A2:I2,MATCH(J2,COUNTIF(OFFSET(A2,,COLUMN(A2:I2)-COLUMN(A2),,J2),">0"),0)),,,,J2))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    04-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Sum values from maximum consecutive string

    Tony - works great! Thanks...much appreciated!!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum values from maximum consecutive string

    You're welcome. Thanks for the feedback!

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sum values from maximum consecutive string

    If there was more than one instance of the maximum number of consecutive week > 0 what result would you want then?
    Audere est facere

+ 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