+ Reply to Thread
Results 1 to 16 of 16

Calculating winning/drawing/losing runs & goal scoring runs

  1. #1
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Calculating winning/drawing/losing runs & goal scoring runs

    Greetings Good People,

    I am attaching two workbooks with the same data (2017/2018 premier league results to the 11th round, but the dates are from 2016). Below is my description of my terminologies:

    H = only home matches considered in calculations.

    A = only away matches considered in calculations

    H/A = both home and away matches considered in calculations

    Winning Streak – number of most consecutive matches won by a team (only won games are considered)

    Winless Streak – number of most consecutive matches played by a team without winning (drawn and lost matches are considered)

    Drawing streak – number of most consecutive matches drawn by a team (only matches drawn are considered)

    Drawless streak – number of most consecutive matches played by a team without drawing (only won and lost matches considered)

    Losing streak – number of most consecutive matches lost by a team (only lost matches considered)

    Lossless Streak – number of most consecutive matches played by a team without losing (only won and drawn matches are considered)

    Scoring streak – number of most consecutive matches played by a team without failure to score (only consider matches where a team scores at least a goal)

    Goalless streak – number of most consecutive matches played by a team without scoring a goal (only consider matches where a team does not score any goal)

    Longest run without conceding – number of most consecutive matches played by a team without a goal being scored by the opponent team

    Longest run with goal conceded – number of most consecutive matches played by a team where the opponent team scores at least a goal

    REQUIRED:

    I would like to be able to compute the above in the two workbooks, but the workbook labeled “Rolling calculations” will consider the number of matches tied to cell N1.

    Note: In the “Rolling Calculations Workbook”, for H calculations, consider the last 4 home matches; for A calculations, consider the latest 4 away matches. However, the matches to be considered for H/A calculations for Manchester united are highlighted in yellow: [4 is the value in cell N1].

    In the all matches workbook, For H calculations, consider all home matches; for the A calculations, consider all away matches; and for H/A calculations, consider all matches played at home and away i.e. sum of home and away matches.

    There is a drop down in cell B2. Selecting a team in this drop down highlights all matches played by that team in read.

    Thanks in advance.

    Rolling Calcultions.xlsx

    ALL MATCHES.xlsx
    OnditiGK

  2. #2
    Forum Contributor shivya's Avatar
    Join Date
    08-19-2017
    Location
    Delhi, India
    MS-Off Ver
    2013
    Posts
    240

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    If You can attach sheet with desired result, it would be easy to understand.
    To attach worksheet Go advanced -> Manage attachments -> Choose file -> Upload
    Don't forget to Mention your desired result in the sheet..
    There should be sample data only, a lot of data creates confusion.

    Thanks & Regards

    Shivya

    http://excelvbatipsforbeginners.blogspot.in/

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Hopefully I'm understanding your request correctly. I first changed the formula in M6 to the following:

    =IF(Teams!$B3="","",TRIM(Teams!B3))

    ...then filled down. Some of your team names on the 'teams' sheet have trailing spaces; TRIM removes those spaces from consideration. For the rest of your table, my formulas followed the same basic structure. All formulas should be array-entered (confirmed with Ctrl + Shift + Enter instead of Enter) and filled down. I used the following in N6 and filled down:

    =SUMPRODUCT(N(IF((H$6:H$150="W")*($D$6:$D$150=$M6),ROW($D$6:$D$150),-1)>MAX(IF((H$6:H$150<>"W")*($D$6:$D$150=$M6),ROW($D$6:$D$150)))))

    This formula finds the row number of all of the team's home wins and compares that to the MAX row number of the team's last non-win. A slight modification gets us the away formula in O6:

    =SUMPRODUCT(N(IF((I$6:I$150="W")*($G$6:$G$150=$M6),ROW($G$6:$G$150),-1)>MAX(IF((I$6:I$150<>"W")*($G$6:$G$150=$M6),ROW($G$6:$G$150)))))

    And then combine the two possibilities for the H/A in P6

    =SUMPRODUCT(N(IF(((H$6:H$150="W")*($D$6:$D$150=$M6))+((I$6:$I$150="W")*($G$6:$G$150=$M6))>0,ROW($D$6:$D$150),-1)>MAX(IF(((H$6:H$150<>"W")*($D$6:$D$150=$M6))+((I$6:$I$150<>"W")*($G$6:$G$150=$M6))>0,ROW($D$6:$D$150)))))

    The rest of the formulas for your other columns are simply modifications on this structure. Change "W" to "L" for losses. Change = to <> and vice versa for winless streak. Change H6:H150="W" to E6:E150>0 for scoring streak, etc. The results that I spot checked in the attachment appeared to be calculating correctly. If you want to cover a larger range, change all of the $150s in the formulas to $1500s, which will allow you to add more score results.

    If you want to shorten the results to only consider the last "X" number of matches (4 in your example), just wrap each formula in a MAX function. For example:

    =MAX(formula, $N$1)

    Hopefully this does the trick? Check out the attachment to see if it helps:
    Attached Files Attached Files
    If your problem has been solved, please use "Thread Tools" to mark the thread as "Solved".

    If you're grateful for this site's existence and would like to contribute to the community, please consider posting something hilarious in our joke thread:
    https://www.excelforum.com/the-water...ke-thread.html

  4. #4
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Thank you so much CAntosh for your reply. Just went through some of the answers generated by the formulas and realized the following:

    Newcastle: most consecutive home games won = 2 games (see game 23 and game 45 where Newcastle wins both games which are consecutive), but the formula in cell N7 returns a zero instead of 2.

    Brighton: most consecutive home games won = 2 games (see game 35and game 59 where Brighton wins both games which are consecutive), but the formula in cell N8 returns a zero instead of two.

    Manchester United Away: this team played the first three consecutive matches away without failing to score (check matches 11, 37 and 54 where man united scores at least a goal. The formula in AG6 returns a zero instead of 3.

    Note: if the most consecutive matches won by a team =2 matches, then the formula should return 2 under winning streak..

    And if the most consecutive matches in which a team has scored a goal = 3 matches, then the formula should return 3 under scoring streak.
    Last edited by gko_87; 11-22-2017 at 03:05 PM. Reason: minor

  5. #5
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Ah, I misunderstood the task. My results show ONGOING streaks, so they show each team's current streak for the given category. Apologies. I can look at what you're requesting, but probably not until next week. Hopefully somebody else will jump in before then.

  6. #6
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    These streaks will be based on all matches played as teams play and should therefore self update as more games are played.

    But the "Rolling Calculations" workbook is the one in which I will need calculations done on a specified number of matches.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    See attached (not completed).

    i changed order of output.

    Can you check results so far.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    See attached sheet "Check" with illustration in columns j:U of logic required for EACH team
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    re-posted updated file as per PM.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Here is the UPDATED file:

    Copy of FINAL TEMPLATE.xlsx
    Attached Files Attached Files
    Last edited by gko_87; 11-25-2017 at 12:44 AM.

  11. #11
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Updated File with actual positioning of data with extra fields deleted.

    Copy of FINAL TEMPLATE.xlsx

  12. #12
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    To all who may assist with this thread:

    Use attachment in post #11 as this shows the actual positioning of data in my actual workbook. The attachments by John Topley in posts #8 and post #9 give desired results using VBA in the fields already worked on.
    Last edited by gko_87; 11-25-2017 at 01:17 AM. Reason: minor

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Please Login or Register  to view this content.
    This uses my first file: if the results are correct, I only need to change the column references for the output
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    Let me go through the file.

  15. #15
    Forum Contributor
    Join Date
    09-13-2016
    Location
    Kenya
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    John, this last attachment differs a lot from your first attachment in post #7. It has a lot of 2's.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Calculating winning/drawing/losing runs & goal scoring runs

    See attached:
    Attached Files Attached Files

+ 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. Calculating team winning-losing streak
    By lastdroidkiller in forum Excel Formulas & Functions
    Replies: 46
    Last Post: 05-15-2018, 11:50 AM
  2. [SOLVED] Macro runs quick initially then bogs down after a few runs
    By pongmeister in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-19-2017, 02:02 PM
  3. VBA runs slow locally, runs fine when connected remotely
    By jbzy324 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2015, 10:05 PM
  4. [SOLVED] Softball Runs for Runs against
    By firefight16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-30-2014, 07:47 PM
  5. Replies: 4
    Last Post: 08-21-2010, 09:09 PM
  6. Excel 2007 : Tables/Goal Seek macro runs in 2007, not 2003
    By Groundwater in forum Excel General
    Replies: 0
    Last Post: 10-19-2009, 04:12 PM
  7. Calculating Longest winning and losing streak.
    By Lewis Koh in forum Excel General
    Replies: 2
    Last Post: 07-27-2009, 08:43 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