+ Reply to Thread
Results 1 to 41 of 41

Rolling/moving average for mixed dat in excel

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

    Rolling/moving average for mixed dat in excel



    Hello every one! I am trying to develop a model for simulation of football statistics in excel and I will really appreciate all the help I can get here.

    I am attaching a spreadsheet named "Rolling Averages" with the English Premier League results to the 7th Round. There is a table in which the average goals for, the average goals conceded, the team form and team form summary need to be captured.

    1. The average goals for and the averages goals conceded should be based on the last five matches played (home and away combined to make last 5 matches)

    2. The team form should also be based on the last 5 matches (home and away matches to make last 5).

    3. The team form summary is the last part of the table and the formula used here should be in such a way that the section self updates every time new matches are played and results added

    4. I need an excel formula that will perform the above commands.

    4. The average goals for, averages goals conceded, team form and team summaries should self update everytime new matches are played and new data added to the workbook.

    5. The expected results for one of the teams (Arsenal) are also included as a guide.

    5. Any modifications to the worksheet to make all the above possible are welcome.

    I will appreciate all the help I can get.




    Rolling Averages.xlsx
    Last edited by gko_87; 10-16-2016 at 06:59 AM. Reason: NOT SCHOOL ASSIGNMENT

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,405

    Re: Rolling/moving average for mixed dat in excel

    Has this been set as a homework assignment?

    Nothing is more frustrating than to be working on homework and to get stuck. Without guidance, you might have no hope of finishing the assignment before the deadline. The Internet can be a big help in that respect, but without learning how to get the right answer, asking others to solve your homework questions for you simply becomes a downward spiral (and it's cheating).

    We do not want to contribute to you cheating yourself out of your education, but we also acknowledge that seeking assistance to learn a concept is a legitimate request.

    If you are genuinely interested in receiving help in the form of tutoring or coaching, then please rephrase the title of your original post to clearly indicate you are seeking coaching or tutoring help. Any forum members (who are willing to assist as a tutor) will modify their responses accordingly to facilitate your learning. Tutors don't tell you the answers, they help you figure it out for yourself; so don't expect answers, expect suggestions, or just plain hints. Also, be specific in describing the function/formula or technique you trying to learn, and tell us what you have attempted so far. Otherwise, expect your plea for homework answers to be ignored.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    Re: Rolling/moving average for mixed dat in excel

    Hello AliGW! No its it's not a homework assignment. Its a model for simulation of football statics that I am trying come up with. Its not course work but a passion that I developed and decided to pursue separately. Please, do not interpret wrongly. It is honestly a personal project that I decided to seek help with.

    Thank you though for the warning.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,405

    Re: Rolling/moving average for mixed dat in excel

    OK, so you say that this is a project, but I don't see any attempt at formulae in your sheet, nor is there any expected outcome data in the table top right. If you want someone to create all the formulae for you, then you need to provide data to work with.

  5. #5
    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,309

    Re: Rolling/moving average for mixed dat in excel

    You have many of the answers (formulae) in the file I posted in reply to your last thread so any reply here will only be "pointers".

    What is the definition of "form"?

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

    Re: Rolling/moving average for mixed dat in excel

    The expected results are below the table (computed manually) not using formulae

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

    Re: Rolling/moving average for mixed dat in excel

    MEANING OF FORM:

    This simply means whether a team has won, lost or drawn in a game.

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

    Re: Rolling/moving average for mixed dat in excel

    The answers in the earlier thread used an equal number of matches from home and away fixtures such that if you use 2 as the interval, 2 matches from home and two matches from away are used which equal to four.

    In this new situation, the interval should be a sum of the last home and away matches.

    The expected results are below the table

  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,309

    Re: Rolling/moving average for mixed dat in excel

    You have the formulae for the AVERAGE calculations in the last file I posted.

    For FORM SUMMARY, if you simply want to count matches (to date) Won , Lost or Drawn look at COUNTIFS function.

    For FORM over last 5 matches, this a variant of the AVERAGE formula already provided: look at AVERAGE as SUM divide by COUNT, so adapting the SUMPRODUCT formulae should provide the required result.

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

    Re: Rolling/moving average for mixed dat in excel

    AliGW, I have a workbook with more than ten football leagues. The part you see is just an extract of the workbook, the only missing part for the model to be complete.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,405

    Re: Rolling/moving average for mixed dat in excel

    So what have you tried? Surely you can adapt what John kindly gave you in the other thread to suit the new situation, can't you, or at least have a go and tell us what you have tried? I am sorry to say but, having just read through the other thread and your requests in this one, you don't seem to be making much of an effort here yourself: you seem to want someone else to do it all for you.

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

    Re: Rolling/moving average for mixed dat in excel

    I have a workbook that computes table team positions, matches played, goals scored, goals scored against, points, etc. The part posted above is just an extract. Its a three four month project so you can imagine how much data I have gathered. I turn to the forum when I get stuck. I love excel and I have recently discovered its analysis capabilities and Excel Forum has the best persons to turn to.

  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,309

    Re: Rolling/moving average for mixed dat in excel

    You might want to consider adding a column for "Home Team", indicating whether the result was "W","L" or "D"; this will help with some of the formulae you need for the other results.

    Post what you think such a formula might be: as per Ali's post, at least try some formulae yourself.

  14. #14
    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,309

    Re: Rolling/moving average for mixed dat in excel

    Re the TEAM FORM: do want order to "oldest to newest" across columns R to V?

    And is "TEAM FORM SUMMARY" matches to date: if so, YOU try COUNTIFS.

  15. #15
    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,309

    Re: Rolling/moving average for mixed dat in excel

    Testing reply works OK.

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

    Re: Rolling/moving average for mixed dat in excel

    For ease of understanding, I am attaching the spreadsheet again with the matches to be considered highlighted in red. John, I tried your function/formula but it is giving 1.60 instead of 2.60. The desired results are the ones in the spreadsheet.

    With the formula:

    =SUMPRODUCT(($D$6:$E$3000)*($B$6:$B$3000>=LARGE(--($C$6:$C$3000=$J8)*($B$6:$B$3000),$M$2))*($C$6:$C$3000=$J8))/$M$2

    I am able to get the desired average goals for but it does not self-update when new data is added or data is deleted, and it seems to be counting empty cells.

    I will be glad to get formula that fills the other columns in the table and self-updates.

    Rolling Averages.xlsx

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

    Re: Rolling/moving average for mixed dat in excel

    Goals conceded are goals scored against.

  18. #18
    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,309

    Re: Rolling/moving average for mixed dat in excel

    There are only 3 home games for Arsenal with goals of 3,2 3 =8 divided by 5 =1.6

    Arsenal Away games have scores of 3,4 and 1 = 8

    Add Home and Away to get 13 divided by 5 = 2.6

    Your solution is average of HOME and AWAY: my solution was HOME only

    You have changed you file which originally had H, M and OVRL!!!! now only OVRL.

    So you solution is correct.

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

    Re: Rolling/moving average for mixed dat in excel

    It is what I wanted. Average for home and away is what I want. Sorry I did not say that before.

  20. #20
    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,309

    Re: Rolling/moving average for mixed dat in excel

    You need to change LARGE to look at BOTH home and AWAY Dates

    =LARGE(--(($C$6:$C$3000=$J8)+($F$6:$F$3000=$J8))*($B$6:$B$3000)

    You are only looking at home dates.

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

    Re: Rolling/moving average for mixed dat in excel

    John, can you help modify the formula so that it self updates when new data is added or data deleted. Empty cells should also be ignored but zeros counted.

    I have been struggling with this since yesterday.

    AND FOR THE TEAM FORMS: can be countif be used

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

    Re: Rolling/moving average for mixed dat in excel

    That formula does not look at the scores which are the key point of reference.

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

    Re: Rolling/moving average for mixed dat in excel

    it only looks at the home column, the away column and the date column

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

    Re: Rolling/moving average for mixed dat in excel

    It does not give the result 2.60

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

    Re: Rolling/moving average for mixed dat in excel

    and the last five home and away matches are not factored in.

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

    Re: Rolling/moving average for mixed dat in excel

    When I try: =LARGE(--(($C$6:$C$3000=$J8)+($F$6:$F$3000=$J8))*($B$6:$B$3000)*($D$6:$E$3000),$M2) i get the "VALUE" error but when i enter the above function as an array i get 127785.00

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

    Re: Rolling/moving average for mixed dat in excel

    what am i missing? the result should be 2.60

  28. #28
    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,309

    Re: Rolling/moving average for mixed dat in excel

    Try

    =(SUMPRODUCT(($D$6:$D$70)*($B$6:$B$70>=LARGE(--(($C$6:$C$70=$J8)+($F$6:$F$70=$J8))*($B$6:$B$70),$M$2))*(($C$6:$C$70=$J8)))+SUMPRODUCT(($E$6:$E$70)*($B$6:$B$70>=LARGE(--(($C$6:$C$70=$J8)+($F$6:$F$70=$J8))*($B$6:$B$70),$M$2))*(($F$6:$F$70=$J8))))/$M$2

    gives 2.6 for Arsenal

    You have to separate the HOME and AWAY games.

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

    Re: Rolling/moving average for mixed dat in excel

    How can I modify the IF functions in the spreadsheet to ignore empty cells. when 2 cell facing each other are both empty, it gives D (Draw) instead og ignoring them


    Rolling Averages.xlsx

  30. #30
    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,309

    Re: Rolling/moving average for mixed dat in excel

    in G

    =IF(D5="","",IF(D5>E5,"W",IF(D5=E5,"D",IF(D5<E5,"L"," "))))

    in H


    =IF(E6="","",IF(E5>D5,"W",IF(E5=D5,"D",IF(E5<D5,"L",""))))

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

    Re: Rolling/moving average for mixed dat in excel

    Thank you so much, that was very helpful. How about the goals conceded? And how would I pull up the match outcomes for Arsenal to fill the cells O8:S8 in last spreadsheet posted?

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

    Re: Rolling/moving average for mixed dat in excel

    Expected results are just below the table.

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

    Re: Rolling/moving average for mixed dat in excel

    Will really appreciate. It will be of great hep and time saving if the functions will autofill downwards also.

  34. #34
    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,309

    Re: Rolling/moving average for mixed dat in excel

    TEAM FORM

    in R8

    =IFERROR(INDEX($G$6:$G$385,LARGE(IF((($C6=$C$6:$C$385)+($C6=$F$6:$F$385)),ROW($A$6:$G$385)-ROW($A$6)+1,""),$M$2-COLUMNS($A:A)+1)),"")

    Enter with Ctrl+Shift+Enter

    Drag across to V and then down

    R8 is OLDEST result, V8 is Latest result

    TEAM format SUMMARY (ALL results to date)

    WINS

    =COUNTIFS($C$6:$C$385,$C6,$G$6:$G$385,"W")+COUNTIFS($F$6:$F$385,$C6,$H$6:$H$385,"W")

    Change "W" to "D" and "L" for "Draws" and "Loss"

  35. #35
    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,309

    Re: Rolling/moving average for mixed dat in excel

    Correction:

    TEAM FORM is wrong formula: need to re-Think!!

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

    Re: Rolling/moving average for mixed dat in excel

    I just tried and its giving me an empty cell? are you able to attach the sheet so i can see, please?

    Have you been able to work on the goals conceded?

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

    Re: Rolling/moving average for mixed dat in excel

    The formula for summary is working but it is basing on all the matches played by the teams. I needed only the latest 5 (home and away) just like the one for average goals conceded as highlighted in the spreadsheet.

  38. #38
    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,309

    Re: Rolling/moving average for mixed dat in excel

    Sorry but my brain is hurting so I am going to take a break until tomorrow.

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

    Re: Rolling/moving average for mixed dat in excel

    Goals conceded, team form and team form summary should also be based on the last five as highlighted. Team summary is basically asking the question: Out of the five matches highlighted, how many are wins, draws or losses for the team in question.

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

    Re: Rolling/moving average for mixed dat in excel

    Ok thanks John. I will also take a break. Thank you so much for you time I really appreciate. See you tomorrow.

  41. #41
    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,309

    Re: Rolling/moving average for mixed dat in excel

    For TEAM FORM (LAST 5):


    I used "helper" columns to return the rows of the last five matches for each team.

    =IFERROR(INDEX(ROW($A$6:$A$385),LARGE(IF((($K8=$C$6:$C$385)+($K8=$F$6:$F$385)),ROW($A$6:$A$385)-ROW($A$6)-4,""),$N$2-COLUMNS($A:A)+1)),"")

    Enter with Ctrl+Shift+Enter

    copy across and down

    in O2

    =IF(INDEX($C$6:$C$385,X8)=$K8,INDEX($G$6:$G$385,X8),INDEX($H$6:$H$385,X8))

    copy across and down

    If TEAM FORM SUMMARY is count of last 5 games, then change to

    =COUNTIF($O8:$S8,"W")

    =COUNTIF($O8:$S8,"D")

    =COUNTIF($O8:$S8,"L")

    in T, U, V
    Attached Files Attached Files
    Last edited by JohnTopley; 10-16-2016 at 04:07 PM.

+ 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. [SOLVED] Rolling/moving average for mixed dat in excel
    By gko_87 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-12-2016, 05:32 PM
  2. [SOLVED] Rolling or Moving Average
    By barney50 in forum Excel General
    Replies: 3
    Last Post: 06-02-2016, 06:35 AM
  3. formula in Excel to calculate rolling daily average of sales total by date
    By Geekgurl in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-17-2014, 05:30 PM
  4. [SOLVED] Rolling/Moving Average: Last "n" values not including blanks in a row
    By Gooner2408 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-24-2013, 12:08 PM
  5. Excel charting - Use Trendline (6 mos Rolling Average)
    By rockycj in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-22-2008, 03:10 PM
  6. Replies: 1
    Last Post: 12-09-2005, 05:15 PM
  7. [SOLVED] excel moving average
    By edba in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2005, 09:06 PM

Tags for this Thread

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