FILTER multiple criteria

macfuller

Active Member
Joined
Apr 30, 2014
Messages
331
Office Version
  1. 365
Platform
  1. Windows
In my NCAA pool we place points per team, with each player winning that number of points each time that team wins. Standings are as shown.



PlayerPointsMax Remaining Points
1Player 419228
2Player 719029
318929
418829
518729
618629
718529
818429
918328

What I would like to do is show next to each player the top x teams s/he still has in the running. So for example Player 4 could show Auburn 10, Florida 9, Houston 7 in the next cell as his top picks, having put 10 on Auburn etc.

A player's picks are stored in the following table. So Player 3's cell opposite the standings would show Florida 10, Houston 9, Auburn 8 (this being what's left in the Final Four).


TeamsTotal PtsPick to WinPlayer 1Player 2Player 3
(01) Auburn1963678
(01) Duke20011810
(01) Florida15545810
(01) Houston16541099
(02) Alabama11452
(02) Michigan St1311931
(02) St. Johns881466
(02) Tennessee8972
(03) Iowa State183
(03) Kentucky285
(03) Texas Tech481
(03) Wisconsin2747
(04) Arizona304
(04) Maryland141
(04) Purdue5
(04) Texas A&M1
(05) Clemson9
(05) Memphis4
(05) Michigan6
(05) Oregon91
(06) BYU33
(06) Illinois4
(07) Kansas17
(07) UCLA6
(08) Gonzaga62
(11) Drake2

I have a named range called LostList that tells whether the team has been knocked out of the tournament. It matches the order of the teams in the pick list above.
...
(01) Houston FALSE
(02) Alabama TRUE
...
etc.

So I would like a TRANSPOSE(FILTER(LARGE(...))) construction that would take the top x teams by player ranking for each player and show it in the cell next to the standings.

Any ideas? Thanks.
 
I'm not entirely clear what you want but would this be headed in the right direction?

25 04 02.xlsm
BCDEFGHIJKL
1PlayerPointsMax Remaining PointsTeamsTotal PtsPick to WinPlayer 1Player 2Player 3
2Player 319228(01) Florida 10, (01) Houston 9, (01) Auburn 8(01) Auburn1963678
319029(01) Duke20011810
418929(01) Florida15545810
518829(01) Houston16541099
618729(02) Alabama11452
718629(02) Michigan St1311931
818529(02) St. Johns881466
918429(02) Tennessee8972
1018328(03) Iowa State183
11(03) Kentucky285
12(03) Texas Tech481
13(03) Wisconsin2747
14(04) Arizona304
15(04) Maryland141
16(04) Purdue5
17(04) Texas A&M1
18(05) Clemson9
19(05) Memphis4
20(05) Michigan6
21(05) Oregon91
22(06) BYU33
23(06) Illinois4
24(07) Kansas17
25(07) UCLA6
26(08) Gonzaga62
27(11) Drake2
macfuller
Cell Formulas
RangeFormula
E2E2=TEXTJOIN({" ",", "},,TAKE(SORT(CHOOSECOLS(G2:L27,1,XMATCH(B2,G1:L1)),2,-1),3))
 
Upvote 0
Yes it is a step in the right direction. I'll have to dig into this further, but I'll check out the link to whether the top team is still playing (e.g. if I put 10 points on MSU but they didn't make it to the final 4).

I can do this above each column for the picks table (tblPicks) where one of the player's columns is "Powers C" and the reference of whether the team is still in the tournament is the Team_Still_Playing array. But I'd like something more elegant along your lines.
Excel Formula:
=LET(
Topt1, LARGE(tblPicks[Powers C] * Team_Still_Playing,1),
Topt2, LARGE(tblPicks[Powers C] * Team_Still_Playing,2),
Topt3, LARGE(tblPicks[Powers C] * Team_Still_Playing,3),
TopN1, IF(Topt1 > 0, XLOOKUP(Topt1,tblPicks[Powers C],tblPicks[[Teams]:[Teams]]) & " " & Topt1 & "pts", ""),
TopN2, IF(Topt2 > 0, ", " & XLOOKUP(Topt2,tblPicks[Powers C],tblPicks[[Teams]:[Teams]]) & " " & Topt2 & "pts", ""),
TopN3, IF(Topt3 > 0, ", " & XLOOKUP(Topt3,tblPicks[Powers C],tblPicks[[Teams]:[Teams]]) & " " & Topt3 & "pts", ""),
TopN1 & TopN2 & TopN3
)

This is the sample of the Team_Still_Playing array. The teams are in the same order in tblPicks and in the array so the "tblPicks[Powers C] * Team_Still_Playing" logic works.


Team Still PlayingTeams
TRUE(01) Auburn
TRUE(01) Duke
TRUE(01) Florida
TRUE(01) Houston
FALSE(02) Alabama
FALSE(02) Michigan St
FALSE(02) St. Johns
FALSE(02) Tennessee
FALSE(03) Iowa State
FALSE(03) Kentucky
FALSE(03) Texas Tech
FALSE(03) Wisconsin
FALSE(04) Arizona
FALSE(04) Maryland
FALSE(04) Purdue
FALSE(04) Texas A&M
 
Upvote 0
See if this is any better. If still not what you want, further explanation needs to focus on the data in the worksheet(s), where it is, what should be returned etc. I don't know anything about the sport, competition, what NCAA or MSU are etc - but I don't need to know that, just what is required from Excel. :)

I have changed the 'Team Still Playing' sample data a bit for testing purposes. Hopefully I have the table structure roughly correct. 😎

If further help needed it might also help if you investigated XL2BB for providing sample data & expected results to make it easier for helpers to understand just what you have & where it is and also what you want & where it is to be. Also easy to copy for testing.
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)

macfuller.xlsm
BEFGHIJKLM
1PlayerTeam Still PlayingTeamsTotal PtsPick to WinPlayer 1Player 2Player 3
2Player 3(01) Florida 10, (01) Auburn 8, (02) St. Johns 6TRUE(01) Auburn1963678
3TRUE(01) Duke20011810
4TRUE(01) Florida15545810
5FALSE(01) Houston16541099
6FALSE(02) Alabama11452
7FALSE(02) Michigan St1311931
8TRUE(02) St. Johns881466
9FALSE(02) Tennessee8972
10FALSE(03) Iowa State183
11FALSE(03) Kentucky285
12FALSE(03) Texas Tech481
13FALSE(03) Wisconsin2747
14FALSE(04) Arizona304
15FALSE(04) Maryland141
16FALSE(04) Purdue5
17FALSE(04) Texas A&M1
18FALSE(05) Clemson9
19FALSE(05) Memphis4
20FALSE(05) Michigan6
21FALSE(05) Oregon91
22FALSE(06) BYU33
23FALSE(06) Illinois4
24FALSE(07) Kansas17
25FALSE(07) UCLA6
26FALSE(08) Gonzaga62
27FALSE(11) Drake2
28
macfuller
Cell Formulas
RangeFormula
E2E2=TEXTJOIN({" ",", "},,TAKE(SORT(CHOOSECOLS(FILTER(tblPicks,tblPicks[Team Still Playing]),2,XMATCH(B2,tblPicks[#Headers])),2,-1),3))
 
Upvote 0
I'm getting a #VALUE error when I tweak it, but I suspect I'm adapting it incorrectly. I have several sheets where relevant formulas are kept so xl2bb would be a bowl of spaghetti... happy to send you the spreadsheet!
I can use the LET statement in my previous post above in a recursive LAMBDA, but I'd love to understand the logic of your solution. I've never used TAKE for example, but it may be a more recent Office 365 syntax. I'm faltering at the intent of the FILTER statement for example. But the logic is worthy of the sadly-departed ExcelXOR website.
Of course the spreadsheet is legacy, built up over many years from at least Excel 2003 onward, so it would require a massive overhaul to do it "right".

I see you're in Australia. The sport is the USA division 1 national college basketball tournament, aka "March Madness", run by the governing college athletic body the NCAA. A significant portion of the (not entirely male) US population creates office pools using various scoring methods and platforms. TV networks have their own pools. Warren Buffet offered $1,000,000 one year for anyone with a perfect bracket (correctly guessing the outcome of all 63 games). (Play-ins didn't count, but we won't go into that. :sleep:) MSU is Michigan State University, one of many collegiate acronyms.
 

Attachments

  • bracket.jpg
    bracket.jpg
    91.1 KB · Views: 3
Upvote 0
I'm getting a #VALUE error when I tweak it,
Without seeing the tweak(s) or the data, hard to offer any constructive comment. However, one guess is that this red 2 in the formula should be the column number in the table of the 'Teams' column (column 2 in my table but perhaps not in yours).
=TEXTJOIN({" ",", "},,TAKE(SORT(CHOOSECOLS(FILTER(tblPicks,tblPicks[Team Still Playing]),2,XMATCH(B2,tblPicks[#Headers])),2,-1),3))

Alternatively the formula could work out that number ..
=TEXTJOIN({" ",", "},,TAKE(SORT(CHOOSECOLS(FILTER(tblPicks,tblPicks[Team Still Playing]),XMATCH("Teams",tblPicks[#Headers]),XMATCH(B2,tblPicks[#Headers])),2,-1),3))

or
Excel Formula:
=LET(hdrs,tblPicks[#Headers],TEXTJOIN({" ",", "},,TAKE(SORT(CHOOSECOLS(FILTER(tblPicks,tblPicks[Team Still Playing]),XMATCH("Teams",hdrs),XMATCH(B2,hdrs)),2,-1),3)))


happy to send you the spreadsheet!
You cannot send it directly to me (or any other forum member) per the intent of #4 of the Forum Rules which is to ensure the public forum is public. :)

An option is to upload a sample workbook somewhere (eg DropBox, OneDrive, Google Drive etc) and provide a publicly shared link here.
Best if any sample file is kept simple and smallish because helpers here will not be familiar with your workbook and if it is too hard to follow then you probably won't get the help you are after.


I'm faltering at the intent of the FILTER statement for example.
The FILTER in my formula is immediately choosing only the rows of the table where 'Team Still Playing' is TRUE so we are only looking at rows of remaining teams.
 
Upvote 0
tblPicks[Teams] and tblPicks[Player x] are in one table. Teams_Still_Playing is a named ranged on a different sheet than tblPicks, though it has the same number of rows as tblPicks (though without the header row). Would I need HSTACK to join them before using CHOOSECOLS?
 
Upvote 0
Would I need HSTACK to join them before using CHOOSECOLS?
No, provided both the table and the named range have the same number of rows and in the same team order you should be able to use ..
Excel Formula:
=LET(hdrs,tblPicks[#Headers],TEXTJOIN({" ",", "},,TAKE(SORT(CHOOSECOLS(FILTER(tblPicks,Teams_Still_Playing),XMATCH("Teams",hdrs),XMATCH(B2,hdrs)),2,-1),3)))
 
Upvote 0
Solution

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