Filtering Data Using not Exact Match

TerrorTot38

New Member
Joined
Feb 2, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I am trying to extract / filter a list of names based on if a player is attending. For example if Player A is FALSE(not playing) only show the last 3 pairs highlighted in the example below.

I have a list of names of players. Column A (Players) Column B (Attending T / F)

- Player A - FALSE
- Player B - TRUE
- Player C - TRUE
- Player D - TRUE

I then have a list of pairs for example. Column D (Pairs not played)

- Player A & Player B
- Player A & Player C
- Player A & Player D
- Player B & Player C
- Player B & Player D
- Player C & Player D


Thus far I have
Excel Formula:
=VLOOKUP("*"&J2&"*",$M$2:$M$104,1,FALSE)

For example Kim and Kimberley are 2 different values.

Any ideas?
 

Attachments

  • 258770105_1398108637315671_8159013031369363497_n.jpg
    258770105_1398108637315671_8159013031369363497_n.jpg
    76.3 KB · Views: 8

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the Forum!

Here's one way:

ABCDEFGH
1PlayerAttending?AllFiltered
2ATRUEABAB
3BTRUEACAD
4CFALSEADAG
5DTRUEAEAH
6EFALSEAFBD
7FFALSEAGBG
8GTRUEAHBH
9HTRUEBCDG
10BDDH
11BEGH
12BF
13BG
14BH
15CD
16CE
17CF
18CG
19CH
20DE
21DF
22DG
23DH
24EF
25EG
26EH
27FG
28FH
29GH
30
Sheet1
Cell Formulas
RangeFormula
G2:H11G2=FILTER(All,MMULT(--VLOOKUP(All,Attending,2),SEQUENCE(2,,,0))=2,"No pairs!")
Dynamic array formulas.
Named Ranges
NameRefers ToCells
All=Sheet1!$D$2:$E$29G2
Attending=Sheet1!$A$2:$B$9G2
 
Upvote 0
Thank you very much for the help on this. To get the data in column D & E. Did you manually extract the data?

If so if there a way to do this automatically using a formula as this would be perfect? I assuming you would use split on & or something similar?
 
Upvote 0
Using the original layout, try this

22 02 03.xlsm
ABCDEF
1PlayerAttending?AllFiltered
2ATRUEA & BA & B
3BTRUEA & CA & D
4CFALSEA & DA & G
5DTRUEA & EA & H
6EFALSEA & FB & D
7FFALSEA & GB & G
8GTRUEA & HB & H
9HTRUEB & CD & G
10B & DD & H
11B & EG & H
12B & F
13B & G
14B & H
15C & D
16C & E
17C & F
18C & G
19C & H
20D & E
21D & F
22D & G
23D & H
24E & F
25E & G
26E & H
27F & G
28F & H
29G & H
30
Filter Players
Cell Formulas
RangeFormula
F2:F11F2=LET(All,D2:D29,Attend,A2:B9,pos,FIND("&",All),FILTER(All,VLOOKUP(LEFT(All,pos-2),Attend,2,0)*VLOOKUP(REPLACE(All,1,pos+1,""),Attend,2,0),"No pairs"))
Dynamic array formulas.
 
Upvote 0
Solution
To get the data in column D & E. Did you manually extract the data?

I used a VBA function:

D2: =INDEX(Attending,GetCombinations(ROWS(Attending),2),1)

where:

VBA Code:
Function GetCombinations(lNumber As Long, lNoChosen As Long) As Long()

    Dim lOutput() As Long, lCombinations As Long
    Dim i As Long, j As Long, k As Long
    
    lCombinations = WorksheetFunction.Combin(lNumber, lNoChosen)
    ReDim lOutput(1 To lCombinations, 1 To lNoChosen)
    
    For i = 1 To lNoChosen
        lOutput(1, i) = i
    Next i
    
    For i = 2 To lCombinations
        For j = 1 To lNoChosen
            lOutput(i, j) = lOutput(i - 1, j)
        Next j
        For j = lNoChosen To 1 Step -1
            lOutput(i, j) = lOutput(i, j) + 1
            If lOutput(i, j) <= lNumber - (lNoChosen - j) Then Exit For
        Next j
        For k = j + 1 To lNoChosen
            lOutput(i, k) = lOutput(i, k - 1) + 1
        Next k
    Next i
    
    GetCombinations = lOutput
    
End Function
 
Upvote 0
Using the original layout, try this

22 02 03.xlsm
ABCDEF
1PlayerAttending?AllFiltered
2ATRUEA & BA & B
3BTRUEA & CA & D
4CFALSEA & DA & G
5DTRUEA & EA & H
6EFALSEA & FB & D
7FFALSEA & GB & G
8GTRUEA & HB & H
9HTRUEB & CD & G
10B & DD & H
11B & EG & H
12B & F
13B & G
14B & H
15C & D
16C & E
17C & F
18C & G
19C & H
20D & E
21D & F
22D & G
23D & H
24E & F
25E & G
26E & H
27F & G
28F & H
29G & H
30
Filter Players
Cell Formulas
RangeFormula
F2:F11F2=LET(All,D2:D29,Attend,A2:B9,pos,FIND("&",All),FILTER(All,VLOOKUP(LEFT(All,pos-2),Attend,2,0)*VLOOKUP(REPLACE(All,1,pos+1,""),Attend,2,0),"No pairs"))
Dynamic array formulas.
Hi, I have tried copying this into F2 however my output is this:
PlayerAttendingAllFiltered
A
TRUE​
A & B
#VALUE!​
B
TRUE​
A & C
#N/A​
C
FALSE​
A & D
#N/A​
D
TRUE​
A & E
#N/A​
E
FALSE​
A & F
#N/A​
F
FALSE​
A & G
#N/A​
G
TRUE​
A & H
#N/A​
H
TRUE​
B & C
#N/A​
B & D
#N/A​

Any ideas why this could be?
 
Upvote 0
Any ideas why this could be?
Yes, I would say that your TRUE/FALSE values in column B are text values not logical values. Try this instead.

22 02 03.xlsm
ABCDEF
1PlayerAttending?AllFiltered
2ATRUEA & BA & B
3BTRUEA & CA & D
4CFALSEA & DA & G
5DTRUEA & EA & H
6EFALSEA & FB & D
7FFALSEA & GB & G
8GTRUEA & HB & H
9HTRUEB & CD & G
10B & DD & H
11B & EG & H
12B & F
13B & G
14B & H
15C & D
16C & E
17C & F
18C & G
19C & H
20D & E
21D & F
22D & G
23D & H
24E & F
25E & G
26E & H
27F & G
28F & H
29G & H
Filter Players (2)
Cell Formulas
RangeFormula
F2:F11F2=LET(All,D2:D29,Attend,A2:B9,pos,FIND("&",All),FILTER(All,(VLOOKUP(LEFT(All,pos-2),Attend,2,0)="TRUE")*(VLOOKUP(REPLACE(All,1,pos+1,""),Attend,2,0)="TRUE"),"No pairs"))
Dynamic array formulas.
 
Upvote 0
Yes, I would say that your TRUE/FALSE values in column B are text values not logical values. Try this instead.

22 02 03.xlsm
ABCDEF
1PlayerAttending?AllFiltered
2ATRUEA & BA & B
3BTRUEA & CA & D
4CFALSEA & DA & G
5DTRUEA & EA & H
6EFALSEA & FB & D
7FFALSEA & GB & G
8GTRUEA & HB & H
9HTRUEB & CD & G
10B & DD & H
11B & EG & H
12B & F
13B & G
14B & H
15C & D
16C & E
17C & F
18C & G
19C & H
20D & E
21D & F
22D & G
23D & H
24E & F
25E & G
26E & H
27F & G
28F & H
29G & H
Filter Players (2)
Cell Formulas
RangeFormula
F2:F11F2=LET(All,D2:D29,Attend,A2:B9,pos,FIND("&",All),FILTER(All,(VLOOKUP(LEFT(All,pos-2),Attend,2,0)="TRUE")*(VLOOKUP(REPLACE(All,1,pos+1,""),Attend,2,0)="TRUE"),"No pairs"))
Dynamic array formulas.
When I've copied this formula I now see No pairs as shown below:

PlayerAttendingAllFiltered
A
TRUE​
A & BNo pairs
B
TRUE​
A & C
C
FALSE​
A & D
D
TRUE​
A & E
E
FALSE​
A & F
F
FALSE​
A & G
G
TRUE​
A & H
H
TRUE​
B & C
B & D
B & E
B & F
B & G
B & H
C & D
C & E
C & F
C & G
C & H
D & E
D & F
D & G
D & H
E & F
E & G
E & H
F & G
F & H
G & H

Thanks again :)
 
Upvote 0
Perhaps you're copying piece-meal? Did you know that with XL2BB you can copy the entire screenshot by clicking as indicated:

1643853438192.png
 
Upvote 0
Perhaps you're copying piece-meal? Did you know that with XL2BB you can copy the entire screenshot by clicking as indicated:

View attachment 56877
Unfortunately my version of Office doesn't support BB2XL. As I have just tried to copy the data as one but just copies a HTML link.

However using one of your answers above and ensure all data in the table was filled out. That answer works but the one after it doesn't for some reason. I have marked it as the solution.

Thanks you very much for all your help again :)
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

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