+ Reply to Thread
Results 1 to 16 of 16

Last 10 win / loss by team

  1. #1
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Last 10 win / loss by team

    Hello

    I have a spreadsheet where I would like to know the win-loss record for the last 10 games by team. I have seen some really cool examples where people have suggested using formulas such as
    =CHOOSE(COUNTIF(OFFSET(A1,LOOKUP(REPT("Z",255),B:B,ROW(A:A))-10,0,10,1),"Win")+1,"0-10","1-9","2-8","3-7","4-6","5-5", "6-4", "7-3", "8-2", "9-1", "10-0") to get the win loss for the last 10 games, but it doesn't take into acct the different teams

    I started using the -find formula combined with lookup such as
    =LOOKUP(, -FIND("Team A",A:A ),ROW(B:B)) to get the row number of the last filled in value for Team A, but I get stuck trying to use offset as in
    =OFFSET(A1, LOOKUP(,-FIND("Team A",A:A ),ROW(B:B))-10, 0) as this gives me the result of the game 10 games before the last game that Team A played regardless of whether that game was played by Team A or Team B.


    Can anyone assist or provide some guidance?

    As an example, my sheet looks like:
    team A Win
    Team A Win
    Team A Loss
    Team B Loss
    Team A Loss
    Team A Loss
    Team A Win
    Team A Win
    Team B Win
    Team B Win
    Team B Loss
    Team B Loss
    Team B Loss
    Team A Loss
    Team B Loss
    Team A Loss
    Team A Win
    Team B Loss
    Team A Win

    The results for Team A should be: 6-4 and for Team B: 2-6

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Last 10 win / loss by team

    Will you please attach a sample Excel workbook? Nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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 Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Last 10 win / loss by team

    I copied your data into excel file. Formulas added.
    Does that work for you?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Re: Last 10 win / loss by team

    Sure thing...
    Attached Files Attached Files

  5. #5
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Last 10 win / loss by team

    Please let us know if the solution offered in post #3 worked for you.

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Last 10 win / loss by team

    If you only want to account for the last 10 games, I would include a helper column in column C:

    C1 =COUNTIF(A$1:A1,A1)
    Copied down column C

    Then, with "Team A" in E1 and "Team B" in E2, try this in F1:
    =COUNTIFS(A$1:A$19,E1,B$1:B$19,"Win",C$1:C$19,"<="&MAX(IF(A$1:A$19=E1,C$1:C$19)),C$1:C$19,">"&MAX(IF(A$1:A$19=E1,C$1:C$19))-10)&"-"&COUNTIFS(A$1:A$19,E1,B$1:B$19,"Loss",C$1:C$19,"<="&MAX(IF(A$1:A$19=E1,C$1:C$19)),C$1:C$19,">"&MAX(IF(A$1:A$19=E1,C$1:C$19))-10) Ctrl Shift Enter
    Copied down column F.

  7. #7
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Re: Last 10 win / loss by team

    Thank you very much modytrane!

    I think it's close, but it calculates the Win/Loss for all games for the team. For example, Team A now shows a 6-5 record, so it's calculating 11 games. I only want the record for the last 10 games that Team A played.
    If I were to add 20 more games dispersed for team A and B, I would only want the last 10 that those teams played.

  8. #8
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Re: Last 10 win / loss by team

    Thank you so much falcondude.. You rock man!

  9. #9
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Last 10 win / loss by team

    You're welcome. Glad we could help.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  10. #10
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Re: Last 10 win / loss by team

    It solved the question I asked, but I just made everything more complicated by splitting my data into multiple sheets (with a pivot table). Should I ask an additional question here, or mark this one as solved, because my question was indeed solved (and start a new thread with my now more complicated question)?

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Last 10 win / loss by team

    No - carry on here, please, to explore the type of solution you require for the same problem.

  12. #12
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Re: Last 10 win / loss by team

    Again, thank you for your help. It solved the original problem with the first workbook. I figured I could use the example to solve a more complicated issue with another workbook, but I don't know if the formula will apply

    You will see 2 sheets in the workbook. Sheet 1 is the data, Sheet 2 is the summary page that contains the pivot table where I want to apply the formula. The pivot table does a nice job of determining the Teams and the versions of that team.
    Each team can have multiple "versions" of that team. What I want to do is calculate the last 10 win/loss record by team and version. I have tried to highlight the rows that correspond to the data that I manually calculated in sheet 2.

    I hope you can help. Thanks again for the help with the first issue.
    Attached Files Attached Files

  13. #13
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Last 10 win / loss by team

    Oh boy... this is going to be ugly...

    If you want to use a Pivot Table, you want the Team Names to be to the left of each version.

    To do this, select your PivotTable > Design > Report Layout > Show in Tabular Form > Repeat All Item Labels. Also, you don't need a Grand Total here so you can get rid of that through Grand Totals > Off for Rows and Columns.

    In D2 of Sheet1, put your helper column (Game #) formula in:
    =COUNTIFS(A$2:A2,A2,B$2:B2,B2)

    Now, in C2 of Sheet2, try this (ugly part):

    =COUNTIFS(Sheet1!A$2:A$759,A2,Sheet1!B$2:B$759,B2,Sheet1!C$2:C$759,"Win",Sheet1!D$2:D$759,"<="&MAX(IF((Sheet1!A$2:A$759=A2)*(Sheet1!B$2:B$759=B2),Sheet1!D$2:D$759)),Sheet1!D$2:D$759,">"&MAX(IF((Sheet1!A$2:A$759=A2)*(Sheet1!B$2:B$759=B2),Sheet1!D$2:D$759))-10)&"-"&COUNTIFS(Sheet1!A$2:A$759,A2,Sheet1!B$2:B$759,B2,Sheet1!C$2:C$759,"Loss",Sheet1!D$2:D$759,"<="&MAX(IF((Sheet1!A$2:A$759=A2)*(Sheet1!B$2:B$759=B2),Sheet1!D$2:D$759)),Sheet1!D$2:D$759,">"&MAX(IF((Sheet1!A$2:A$759=A2)*(Sheet1!B$2:B$759=B2),Sheet1!D$2:D$759))-10) Ctrl Shift Enter

    See Attachment.
    Attached Files Attached Files

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Last 10 win / loss by team

    Going off of post #13, if you plan on adding data, I would format the data in Sheet1 as a table and then reference to that table (in the PivotTable Data Source and formulas).

    Then, the formula in Sheet2 C2 would look like this:

    =COUNTIFS(Table1[Team Name],A2,Table1[Version],B2,Table1[Result],"Win",Table1[Game '#],"<="&MAX(IF((Table1[Team Name]=A2)*(Table1[Version]=B2),Table1[Game '#])),Table1[Game '#],">"&MAX(IF((Table1[Team Name]=A2)*(Table1[Version]=B2),Table1[Game '#]))-10)&"-"&COUNTIFS(Table1[Team Name],A2,Table1[Version],B2,Table1[Result],"Loss",Table1[Game '#],"<="&MAX(IF((Table1[Team Name]=A2)*(Table1[Version]=B2),Table1[Game '#])),Table1[Game '#],">"&MAX(IF((Table1[Team Name]=A2)*(Table1[Version]=B2),Table1[Game '#]))-10) Ctrl Shift Enter

    See attachment for table usage.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    11-03-2017
    Location
    Wilmington, DE
    MS-Off Ver
    2013
    Posts
    29

    Re: Last 10 win / loss by team

    Wow! Thanks so much!

  16. #16
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Last 10 win / loss by team

    You're welcome. Happy to help.

    Thanks for the rep!

+ 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. Help with win loss and tie column & adding profit based on win or loss.
    By schroeder641 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2016, 03:41 PM
  2. Total Team Members with correct Team Leader
    By PrimalByte in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-05-2015, 04:23 PM
  3. [SOLVED] Trading Spreadsheet - Random win/loss outcome against established Win/Loss %
    By cruze2005 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-18-2014, 05:08 AM
  4. Sports Team Win/Loss/Draw/Upcoming spreadsheet
    By Exodus_NZ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-23-2013, 06:51 AM
  5. Replies: 2
    Last Post: 12-06-2012, 06:02 PM
  6. Using sumif to show win loss when 1 team plays 4 others
    By Laurence1965 in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 09-22-2011, 02:07 PM
  7. Multiple team "All-Play" Won, loss, tie records
    By swig via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2005, 11:05 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