+ Reply to Thread
Results 1 to 10 of 10

Longest streak and current streak if data are placed in two columns

Hybrid View

  1. #1
    Registered User
    Join Date
    06-15-2013
    Location
    Spain
    MS-Off Ver
    Excel 2003
    Posts
    17

    Longest streak and current streak if data are placed in two columns

    Hello all

    How can i calculate the longest streak and the current streak of specific soccer results (ex: 1-1) if goals are placed in two columns.
    Ex 1:
    A B
    2 0
    1 1
    1 1
    1 1
    1 1
    1 1
    2 3
    2 1
    1 1
    1 1

    results:
    Longest 1-1 streak: 5
    Current 1-1 streak: 2

    Ex 2:
    A B
    2 0
    1 1
    1 1
    1 1
    1 1
    1 1
    2 3
    2 1
    1 1
    1 1
    2 2
    results:
    Longest 1-1 streak: 5
    Current 1-1 streak: 0 this is because the actual result (2-2) is <>1-1, so the last streak of 1-1 is ignored.

    Thanks

  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: Longest streak and current streak if data are placed in two columns

    With your data in the range A2:B11...

    For the longest streak of 1-1...

    Array entered**:

    =MAX(FREQUENCY(IF((A2:A11=1)*(B2:B11=1),ROW(A2:A11)),IF(A2:A11<>1,ROW(A2:A11))))

    ** 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.

    Not sure I understand the current streak requirement.
    Last edited by Tony Valko; 10-05-2016 at 11:42 AM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: Longest streak and current streak if data are placed in two columns

    Ok, I think I figured it out.

    With your data in the range A2:B11...

    D2 = 1
    E2 = 1

    For the longest streak of 1-1...

    Array entered**:

    =MAX(FREQUENCY(IF((A2:A11=D2)*(B2:B11=E2),ROW(A2:A11)),IF(A2:A11<>D2,ROW(A2:A11))))

    For the current streak...

    Array entered**:

    =IF(OR(LOOKUP(1000,A2:A11)<>D2,LOOKUP(1000,B2:B11)<>E2),0,LOOKUP(1000,FREQUENCY(IF((A2:A11=D2)*(B2:B11=E2),ROW(A2:A11)),IF((A2:A11<>D2)*(B2:B11<>E2),ROW(A2:A11)))))

    ** 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.

  4. #4
    Registered User
    Join Date
    06-15-2013
    Location
    Spain
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Longest streak and current streak if data are placed in two columns

    Hi and above all thanks for your quick answer Tony Valko!

    I know you are a expert in streaks because i saw many responses from you about this, and very good answers btw.

    First formulas work perfect, the current streak formulas (both) works ok if all cells have data in all the range.
    Per instance I am using the A2:B11 range, if last cells are blanks the current streak formula gives me zero values.

    Forgive me if i ask, there is any way to calculate without using the helper cells?.

    edit:
    sorry for the silly question of the helper cells, i just changed the value in the formula for the desired result an problem solved.
    I am stuck on the longest streak for 0-0 and other results.
    Last edited by Lehoi; 10-05-2016 at 01:40 PM.

  5. #5
    Registered User
    Join Date
    06-15-2013
    Location
    Spain
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Longest streak and current streak if data are placed in two columns

    I made a few test and the longest streak formula works ok for tie results, ej; 1-1, 2-2, etc, but for the 0-0 result the blanks cells are considered as 0 too
    If i want to adapt the formula for other results than ties like 0-1, 2-3, etc, how can i do that? i can change the values in the first part of the formula, but in the second part there is only one value i can change.

    Sorry for so many questions

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

    Re: Longest streak and current streak if data are placed in two columns

    It sounds like you should use dynamic ranges to avoid the empty cells.

    Like:

    Range1
    Refers to: =$A$2:INDEX($A:$A,MATCH(1000,$A:$A))

    Range2
    Refers to: =$B$2:INDEX($B:$B,MATCH(1000,$B:$B))

    Here's a sample file with this implemented.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-15-2013
    Location
    Spain
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Longest streak and current streak if data are placed in two columns

    Interesting and very effective solution!, works perfect.

    Thank you!!!

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

    Re: Longest streak and current streak if data are placed in two columns

    You're welcome. Thanks for the feedback!

  9. #9
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Longest streak and current streak if data are placed in two columns

    Lehoi,

    You may be interested in taking a look at this small version of a league table that incorporates formulas for past 6 results, next 6 fixtures, winning streaks and losing streaks.
    The workbook has been butchered to remove Fantasy league players & scores btw so some aspects of the workbook may seem a bit OTT.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-15-2013
    Location
    Spain
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Longest streak and current streak if data are placed in two columns

    Quote Originally Posted by BlindAlley View Post
    Lehoi,

    You may be interested in taking a look at this small version of a league table that incorporates formulas for past 6 results, next 6 fixtures, winning streaks and losing streaks.
    The workbook has been butchered to remove Fantasy league players & scores btw so some aspects of the workbook may seem a bit OTT.
    A spreadsheet very impressive with a lot of things that i will use it to improve mine (very modest spreadsheet compared to yours).
    Thank you very much for your help BlindAlley!

+ 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. Counting the longest streak of negative numbers
    By nbudrow in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-25-2014, 11:31 AM
  2. Last X games, Max Win and Loss streak, current streak with Excel formulas
    By Biogeek1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-12-2013, 11:00 AM
  3. Replies: 4
    Last Post: 08-21-2010, 09:09 PM
  4. Calculating Longest winning and losing streak.
    By Lewis Koh in forum Excel General
    Replies: 2
    Last Post: 07-27-2009, 08:43 AM
  5. Requiring help calculating longest winning streak
    By kamran in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 12-06-2006, 02:51 AM
  6. Require help calculating longest winning streak
    By kamran in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-05-2006, 09:39 PM

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