How to display record of last 10 games

dotcanada

Board Regular
Joined
Dec 13, 2015
Messages
52
Office Version
  1. 2016
Platform
  1. Windows
Good day.

I have been banging my head against the wall trying to figure this out. I've search past posts on this topic but still can't figure it out.
I've attached a sample of my spreadsheet of the schedule. What I would like to do is display the record of each teams' the last 10 games ((W-L-OTL) for each team).

Many thanks in advance.

2023-24 NHL Season (2).xlsx
ABCDEFGHIJKLM
1HomeVisitor
2DateTeamScoreOTRWROWW/L/OTLScoreOTRWROWW/L/OTLTeam
3Tuesday, October 10, 2023Tampa Bay Lightning5xxW3LNashville Predators
4Pittsburgh Penguins2L4xxWChicago Blackhawks
5Vegas Golden Knights4xxW1LSeattle Kraken
6Wednesday, October 11, 2023Carolina Hurricanes5xxW3LOttawa Senators
7Toronto Maple Leafs6W5xOTLMontréal Canadiens
8Boston Bruins3xxW1LChicago Blackhawks
9Calgary Flames5xxW3LWinnipeg Jets
10Los Angeles Kings2L5xxWColorado Avalanche
11Vancouver Canucks8xxW1LEdmonton Oilers
12Thursday, October 12, 2023Buffalo Sabres1L5xxWNew York Rangers
13Columbus Blue Jackets2L4xxWPhiladelphia Flyers
14New Jersey Devils4xxW3LDetroit Red Wings
15Dallas Stars2W1xOTLSt. Louis Blues
16Minnesota Wild2xxW0LFlorida Panthers
17Nashville Predators3xxW0LSeattle Kraken
18San Jose Sharks1L4xxWVegas Golden Knights
19Friday, October 13, 2023New Jersey Devils3xOTL4WArizona Coyotes
20Washington Capitals0L4xxWPittsburgh Penguins
21Saturday, October 14, 2023Ottawa Senators5xxW2LPhiladelphia Flyers
22Winnipeg Jets6xxW4LFlorida Panthers
23Boston Bruins3xxW2LNashville Predators
24Columbus Blue Jackets5xxW3LNew York Rangers
25Detroit Red Wings6xxW4LTampa Bay Lightning
26Montréal Canadiens3xxW2LChicago Blackhawks
27Pittsburgh Penguins5xxW2LCalgary Flames
28Toronto Maple Leafs7xxW4LMinnesota Wild
29New York Islanders3xxW2LBuffalo Sabres
30St. Louis Blues2W1xOTLSeattle Kraken
31Edmonton Oilers3L4xxWVancouver Canucks
32San Jose Sharks1xOTL2WColorado Avalanche
33Vegas Golden Knights4xxW1LAnaheim Ducks
34Los Angeles Kings5xOTL6WCarolina Hurricanes
35Sunday, October 15, 2023Ottawa Senators5xxW2LTampa Bay Lightning
36Anaheim Ducks6xxW3LCarolina Hurricanes
37Monday, October 16, 2023Columbus Blue Jackets0L4xxWDetroit Red Wings
38New Jersey Devils3L4xxWFlorida Panthers
39New York Rangers2xxW1LArizona Coyotes
40Toronto Maple Leafs1L4xxWChicago Blackhawks
41Washington Capitals3W2xOTLCalgary Flames
Schedule
Cell Formulas
RangeFormula
G3:G41G3=IF(C3>H3,"W",IF(D3="x","OTL",IF(C3<H3,"L","")))
L3:L41L3=IF(C3<H3,"W",IF(I3="x","OTL",IF(C3>H3,"L","")))



Also asked here How to display record of last 10 games plus streak
 
Last edited by a moderator:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try:

Book1
ABCDE
45TeamLast 10 record (W-L-OTL)Last 10 record (W-L-OTL)(Helper)
46Anaheim Ducks1-1-01-1-01
47Boston Bruins2-0-02-0-01
48Buffalo Sabres0-2-00-2-01
49Calgary Flames1-1-11-1-11
50Carolina Hurricanes2-1-02-1-01
51Columbus Blue Jackets1-2-01-2-01
52Dallas Stars1-0-01-0-01
53Detroit Red Wings2-1-02-1-01
54Edmonton Oilers0-2-00-2-01
55Los Angeles Kings0-1-10-1-11
56Minnesota Wild1-1-01-1-01
57Montréal Canadiens1-0-11-0-11
58Nashville Predators1-2-01-2-01
59New Jersey Devils1-1-11-1-11
60New York Islanders1-0-01-0-01
61New York Rangers2-1-02-1-01
62Ottawa Senators2-1-02-1-01
63Pittsburgh Penguins2-1-02-1-01
64San Jose Sharks0-1-10-1-11
65St. Louis Blues1-0-11-0-11
66Tampa Bay Lightning1-2-01-2-01
67Toronto Maple Leafs2-1-02-1-01
68Vancouver Canucks2-0-02-0-01
69Vegas Golden Knights3-0-03-0-01
70Washington Capitals1-1-01-1-01
71Winnipeg Jets1-1-01-1-01
Sheet9
Cell Formulas
RangeFormula
A46:A71A46=SORT(UNIQUE(B3:B41))
D46:D71D46=COUNTIFS(INDEX(B:B,E46):B$41,A46,INDEX(G:G,E46):G$41,"W")+COUNTIFS(INDEX(M:M,E46):M$41,A46,INDEX(L:L,E46):L$41,"W")&"-"&COUNTIFS(INDEX(B:B,E46):B$41,A46,INDEX(G:G,E46):G$41,"L")+COUNTIFS(INDEX(M:M,E46):M$41,A46,INDEX(L:L,E46):L$41,"L")&"-"&COUNTIFS(INDEX(B:B,E46):B$41,A46,INDEX(G:G,E46):G$41,"OTL")+COUNTIFS(INDEX(M:M,E46):M$41,A46,INDEX(L:L,E46):L$41,"OTL")
E46:E71E46=IFERROR(AGGREGATE(14,6,ROW($A$3:$A$41)/SIGN(($B$3:$B$41=A46)+($M$3:$M$41=A46)),10),1)
B46:B71B46=LET(s,IF($B$2:$B$41=A46,$G$2:$G$41,IF($M$2:$M$41=A46,$L$2:$L$41,"")),f,FILTER(s,s<>""),r,ROWS(f),seq,SEQUENCE(r),ff,FILTER(f,seq>r-10),SUM(IF(ff="W",1))&"-"&SUM(IF(ff="L",1))&"-"&SUM(IF(ff="OTL",1)))
Dynamic array formulas.


Also, PLEASE update your profile to show what version of Excel you're using. I created a formula (B46) using array formulas. Then I noticed on the other forum you posted on that you only have Excel 2016, so I had to go back and come up with another version (D6, with a helper cell in E6).

Let us know how this works.
 
Upvote 0
Firstly, MANY thanks for your help with this and do appreciate and respect your time. And my apologies for the archaic version of office I'm using (2016). I do plan to get 2024 when it's made available later in the year. I am just revisiting my spreadsheet and using the only version I have available at this time.

Also, just some FYI (sorry, I should had mentioned this initially), the schedule I provided was just a sample of the first few rows of the sheet (the number of rows I actually have is 1314 on this sheet).
This schedule is for this current NHL season. Therefore, there are a lot of blank cells for the upcoming dates. So, I changed OPTION in the AGGREGATE from 6 to 4. This gave me a value (under the "Helper" heading) of 1 (it gave me a much larger number before). Another change I made was that I noticed you put B$41, G$41, M$41, and L$41, I assume to indicate the end of the table. I replaced these values with the values of the actual end of my schedule (in my case B$1314, G$1314, M$1314, and L$1314). For testing purposes, I'm using the Boston Bruins (I have a separate sheet with the list of teams on it).

Once these changes were in place, in the "Last 10 Record" column, unfortunately it's giving me the team's total record of the season up until today.

Would it be okay to paste the entire schedule? I used the D46 formula almost to the letter (with the exception of the replacements mentioned above).

Thanks again for your time. Cheers.
 
Upvote 0
Thank you for updating your profile.

Yes, of course you should change the $41 to the end of your table in both the D and E formulas. The $3 in the E formula is the start of the table.

However, the option in AGGREATE must be 6, not 4! The purpose of that formula is to find the 10th largest row that has the given team in it. The AGGREGATE is constructed to give an error for every row that doesn't have the given team in it, so the LARGE (14) option only looks at the rows with the given team. Then it picks the 10th highest. If there are fewer than 10 rows, then that's where the IFERROR comes into the picture, and tells the D formula to start looking at row 1.

However, if you want to exclude games that are scheduled but not played yet, change the E formula to:

Excel Formula:
=IFERROR(AGGREGATE(14,6,ROW($A$3:$A$41)/SIGN(($B$3:$B$41=A46)+($M$3:$M$41=A46))/($G$3:$G$41<>""),10),1)

Try that to see if it works. You can't post a 1300 row table here, but there are options.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,099
Messages
6,170,109
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top