LAST 3 Events in 2 Seperate Columns?

AYouQueTai

New Member
Joined
Sep 14, 2019
Messages
34
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have the NHL hockey games listed in my Schedule sheet like so.

Game ID | Status | Date | Visitor | Home | Vis Goals | Home Goals |
02001 | Completed | Jan18 | Montreal | Vancouver | 3 | 5
02002 | Completed | Jan18 | Toronto | Winnipeg | 4 | 2
02003 | Completed | Jan19 | Ottawa | Montreal | 5 | 1
02004 | Completed | Jan19 | Ottawa | Toronto | 6 | 2
02005 | Completed | Jan 20 | Montreal | Toronto | 3 | 2
02006 | Scheduled | Jan21 | Vancouver| Montreal | |

I would like to make a team sheet that lists a team's Last 3 "Completed" game Results.
Whether they were Visitor or Home doesn't matter
So in the Montreal Team Sheet it would display

Visitor | Home | Vis Goals | Home Goals |
Montreal | Vancouver | 3 | 5
Ottawa | Montreal | 5 | 1
Montreal | Toronto | 3 | 2

I can't figure this one out, can any of you?
Thanks,
 
@alz, would you be so kind as to run a timer test on this version as well please :)

Book1
ABCDEFGHIJKL
1Game ID Status Date Visitor Home Vis Goals Home Goals MontrealCompleted(last 3 match)
22001Completed Jan18 MontrealVancouver35 Visitor Home Vis Goals Home Goals
32002Completed Jan18 torantoWinnipeg42MontrealVancouver35
42003Completed Jan19 OttawaMontreal51OttawaMontreal51
52004Completed Jan19 OttawaToronto62MontrealToronto32
62005Completed Jan 20 MontrealToronto32
72006 Scheduled Jan21 VancouverMontreal
Sheet2
Cell Formulas
RangeFormula
I3:L5I3=IFERROR(INDEX(D$2:D$100000,AGGREGATE(14,6,ROW(D$2:D$100000)/($D$2:$E$100000=$I$1)/($B$2:$B$100000="Completed"),ROWS(I3:I$5))-ROW(D$2)+1),"")
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
@jasonb75 I tested on both 100,000 rows and 500,000 rows .here is the result.


Excel Message board - Copy.xlsm
HIJKLMNOPQRSTUVWXYZAA
4MontrealCompletedALZ
5 Visitor Home Vis Goals Home Goals Tested on 500,000 rowsAverageRankTested on 100,000 rowsAverageRank
6MontrealToronto322.458982.568592.488662.50541434%A0.546340.534220.532290.537616667425%
7MontrealVancouver35AB0.743780.733620.736620.738006667572%
8OttawaMontreal51C0.435470.434920.432540.4343121%
9D0.430540.426730.428840.42870333310%
10Montreal3FlufforiginalE0.494860.486390.495820.492356667315%
11MontrealToronto323.454073.288223.198313.313533577%
12MontrealVancouver35B
13OttawaMontreal51
14
15MontrealJason
163MontrealToronto321.87841.863051.865051.86883310%
172MontrealVancouver35C
181OttawaMontreal51
19
20MontrealFlufftweak
21MontrealToronto321.899721.922411.905221.90911722%
22MontrealVancouver35D
23OttawaMontreal51
24
25MontrealJason
26MontrealToronto322.005121.98551.976121.98891336%
27MontrealVancouver35E
28OttawaMontreal51
30 (2)
Cell Formulas
RangeFormula
I6:L8I6=INDEX(D$2:D$500000,AGGREGATE(14,6,(ROW($D$2:$D$500000)-ROW($D$2)+1)/((--($B$2:$B$500000=$J$4))+(--($I$4=$D$2:$D$500000))+(--($I$4=$E$2:$E$500000))=2),ROWS($I6:$I$8)))
Q6,Q26,Q21,Q16,Q11Q6=AVERAGE(N6:P6)
R6,R26,R21,R16,R11R6=RANK(Q6,$Q$6:$Q$26,1)
S6,S26,S21,S16,S11S6=(Q6-$Q$16)/$Q$16
J10J10=MIN(3,COUNTIFS(D2:E7,I10,F2:G7,"<>"))
AA6:AA10AA6=(Y6-$Y$9)/$Y$9
I11:L13I11=IFERROR(INDEX(D$2:D$500000,AGGREGATE(14,6,(ROW($D$2:$D$500000)-ROW($D$2)+1)/(($D$2:$D$500000=$I$10)+($E$2:$E$500000=$I$10))/($B$2:$D$500000="Completed"),ROWS($I11:$I$13))),"")
I16:L18I16=INDEX(D$2:D$500000,AGGREGATE(14,6,ROW($D$2:$D$500000)/(($B$2:$B$500000="Completed")*(($I$15=$D$2:$D$500000)+($I$15=$E$2:$E$500000))>0),$H16)-ROW($D$2)+1)
I21:L23I21=IFERROR(INDEX(D$2:D$500000,AGGREGATE(14,6,(ROW($D$2:$D$500000)-ROW($D$2)+1)/(($D$2:$D$500000=$I$20)+($E$2:$E$500000=$I$20))/($B$2:$B$500000="Completed"),ROWS($I21:$I$23))),"")
I26:L28I26=IFERROR(INDEX(D$2:D$500000,AGGREGATE(14,6,ROW(D$2:D$500000)/($D$2:$E$500000=$I$25)/($B$2:$B$500000="Completed"),ROWS(I3:I$5))-ROW(D$2)+1),"")
 
Upvote 0
Thanks for that @alz, I was curious to see how it compared. From your test results it appears that processing the 2 columns with the team names individually is more efficient than doing them together.

I didn't think that it would be an improvement but I was expecting it to be very close to the timing of the other formula, I was surprised by how much slower it was.
 
  • Like
Reactions: alz
Upvote 0

Forum statistics

Threads
1,215,650
Messages
6,126,016
Members
449,280
Latest member
Miahr

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