Fetch heads up stats between 2 teams

AYouQueTai

Board Regular
Joined
Sep 14, 2019
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I have the following formula that fetches a teams last 10 games (whether home or away) and it all I have to do is change the @INDEX(Results[GameID] range at the start of the formula to get the date, visitor team, vis goals, home team, home goals etc...This formula works great. (A30:F30) in "Over Under" sheet.
=IFERROR(@INDEX(Results[GameID],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")

I have tried to modify it to fetch the "season series" of games between 2 specific teams (games played in both cities so both teams can appear in the home or visitors range) but haven't been able to figure it out.
The Over Under sheet has the visiting team in A8 and the home team in N8. I would like to fill the A23:F26 with the data from the results sheet.

Can anyone help?
Thanks,

NHL 2023-2024.xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1Game ID020884
2Date & TimeWednesdayFeb-218:00 PM
3Over/UnderProline StadiumPinnacle.com
4OverO%LineU%UnderOverO%LineU%Under
51.88053.2%6.552.1%1.9201.91752.2%6.551.0%1.961
6
7Visitor TeamScoreHome TeamScore
8Buffalo0Montreal0
9
10
11Days of Rest1Days of Rest3
12TripTrip
13
14LeagueGamesOverOver %PushPush %UnderUnder %
156.587541447.3%00.0%46152.7%
16
17TeamsGamesOverOver %PushPush %UnderUnder %
18Buffalo261350.0%00.0%1350.0%
19Montreal291655.2%00.0%1344.8%
20
21Season Series
22Game IDDateVisitorVtotHomeHtotOU Result
23
24
25
26
27
28Buffalo - Last 10
29Game IDDateVisitorVgoalHomeHgoalVresult
30020866Feb-19Anaheim4Buffalo3Over
31020854Feb-17Buffalo3Minnesota2Under
32020838Feb-15Florida4Buffalo0Under
33020824Feb-13Los Angeles0Buffalo7Over
34020804Feb-10St-Louis3Buffalo1Under
35020784Feb-06Dallas2Buffalo1Under
36020762Jan-27Buffalo5San Jose2Over
37020745Jan-24Buffalo5Los Angeles3Over
38020737Jan-23Buffalo2Anaheim4Under
39020706Jan-20Tampa Bay3Buffalo1Under
OverUnder
Cell Formulas
RangeFormula
B2B2=INDEX(Schedule,MATCH($B$1,Schedule[GameID],0),3)
C2C2=INDEX(Schedule,MATCH($B$1,Schedule[GameID],0),4)
D2D2=INDEX(Schedule,MATCH($B$1,Schedule[GameID],0),5)
B5B5=INDEX(Odds,MATCH($B$1,Odds[GameID],0),7)
C5,H5C5=1/B5
D5D5=INDEX(Odds,MATCH($B$1,Odds[GameID],0),8)
E5,J5E5=1/F5
F5F5=INDEX(Odds,MATCH($B$1,Odds[GameID],0),9)
G5G5=INDEX(Odds,MATCH($B$1,Odds[GameID],0),12)
I5I5=INDEX(Odds,MATCH($B$1,Odds[GameID],0),13)
K5K5=INDEX(Odds,MATCH($B$1,Odds[GameID],0),14)
A8A8=INDEX(Results,MATCH($B$1,Results[GameID],0),6)
J8J8=INDEX(Results,MATCH($B$1,Results[GameID],0),7)
N8N8=INDEX(Results,MATCH($B$1,Results[GameID],0),15)
W8W8=INDEX(Results,MATCH($B$1,Results[GameID],0),16)
B11B11=INDEX(Schedule,MATCH($B$1,Schedule[GameID],0),8)
O11O11=INDEX(Schedule,MATCH($B$1,Schedule[GameID],0),12)
A15A15=I5
B15B15=SUMPRODUCT((Schedule[Status]="Completed")*1)
C15C15=SUMPRODUCT((Results[Status]="Completed")*(Results[GaTo]>[@League]))
D15,D18:D19D15=[@Over]/[@Games]
E15E15=SUMPRODUCT((Results[Status]="Completed")*(Results[GaTo]=[@League]))
F15,F18:F19F15=[@Push]/[@Games]
G15G15=SUMPRODUCT((Results[Status]="Completed")*(Results[GaTo]<[@League]))
H15,H18:H19H15=[@Under]/[@Games]
A18A18=A8
B18B18=SUMPRODUCT((Results[Status]="Completed")*(Results[Visitor]=[@Teams]))
C18C18=SUMPRODUCT((Results[Status]="Completed")*(Results[Visitor]=[@Teams])*(Results[GaTo]>$D$5))
E18E18=SUMPRODUCT((Results[Status]="Completed")*(Results[Visitor]=[@Teams])*(Results[GaTo]=$D$5))
G18G18=SUMPRODUCT((Results[Status]="Completed")*(Results[Visitor]=[@Teams])*(Results[GaTo]<$D$5))
A19A19=N8
B19B19=SUMPRODUCT((Results[Status]="Completed")*(Results[Home]=[@Teams]))
C19C19=SUMPRODUCT((Results[Status]="Completed")*(Results[Home]=[@Teams])*(Results[GaTo]>$D$5))
E19E19=SUMPRODUCT((Results[Status]="Completed")*(Results[Home]=[@Teams])*(Results[GaTo]=$D$5))
G19G19=SUMPRODUCT((Results[Status]="Completed")*(Results[Home]=[@Teams])*(Results[GaTo]<$D$5))
A28A28=CONCATENATE($A$8," - Last 10")
A30A30=IFERROR(@INDEX(Results[GameID],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")
B30:B39B30=IFERROR(@INDEX(Results[Date],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")
C30:C39C30=IFERROR(@INDEX(Results[Visitor],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")
D30:D39D30=IFERROR(@INDEX(Results[VTot],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")
E30:E39E30=IFERROR(@INDEX(Results[Home],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")
F30:F39F30=IFERROR(@INDEX(Results[HTot],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A30))),"")
G30:G39G30=IF(SUM(D30,F30)>$D$5,"Over",IF(SUM(D30,F30)<$D$5,"Under","Push"))
A31:A39A31=IFERROR(INDEX(Results[GameID],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home])),ROWS($A$30:$A31))),"")
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Cell Formulas
RangeFormula
B2:B11B2=INDEX(Schedule,MATCH([@GameID],Schedule[GameID],0),2)
C2:C11C2=INDEX(Schedule,MATCH([@GameID],Schedule[GameID],0),3)
D2:D11D2=INDEX(Schedule,MATCH([@GameID],Schedule[GameID],0),4)
F2:F11F2=INDEX(Schedule,MATCH([@GameID],Schedule[GameID],0),9)
G2:G11G2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[GF Team]=[@Visitor]))
H2:H11H2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[Goal '#]=1)*(Goals[GF Team]=[@Visitor]))
I2:I11I2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[Period]=1)*(Goals[GF Team]=[@Visitor]))
J2:J11J2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[Period]=2)*(Goals[GF Team]=[@Visitor]))
K2:K11K2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[Period]=3)*(Goals[GF Team]=[@Visitor]))
L2:L11L2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[Period]="OT")*(Goals[GF Team]=[@Visitor]))
M2:M11M2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Visitor]=[@Visitor])*(Goals[Period]="SO")*(Goals[GF Team]=[@Visitor]))
O2:O11O2=INDEX(Schedule,MATCH([@GameID],Schedule[GameID],0),13)
P2:P11P2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[GF Team]=[@Home]))
Q2:Q11Q2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[Goal '#]=1)*(Goals[GF Team]=[@Home]))
R2:R11R2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[Period]=1)*(Goals[GF Team]=[@Home]))
S2:S11S2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[Period]=2)*(Goals[GF Team]=[@Home]))
T2:T11T2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[Period]=3)*(Goals[GF Team]=[@Home]))
U2:U11U2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[Period]="OT")*(Goals[GF Team]=[@Home]))
V2:V11V2=SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Home]=[@Home])*(Goals[Period]="SO")*(Goals[GF Team]=[@Home]))
W2:W11W2=IF(AND(SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Period]="OT"))=0,SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Period]="SO"))=0),"",IF(SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Period]="OT"))=1,"OT",IF(SUMPRODUCT((Goals[GameID]=[@GameID])*(Goals[Period]="SO"))=1,"SO")))
X2:X11X2=SUM([@VTot],[@HTot])
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E2:E889Expression=$G2<$P2textNO
E2:E889Expression=$G2>$P2textNO
N2:N889Expression=$P2<$G2textNO
N2:N889Expression=$P2>$G2textNO
 
Upvote 0
Oh, nevermind I got it. Thanks anyway
=IFERROR(@INDEX(Results[GameID],AGGREGATE(14,6,(ROW(Results[Visitor])-ROW('Results'!$F$2)+1)/(Results[Status]="Completed")/(Results[Date]<$C$2)/(($A$8=Results[Visitor])+($A$8=Results[Home]))/(($N$8=Results[Visitor])+($N$8=Results[Home])),ROWS($A$30:$A30))),"")
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

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