Filter words only not containing.

LEFROGUE

New Member
Joined
Jul 16, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hello,

i am wondering how to filter words in a data set. e.g men, male without it being part of other words (lament, female etc).

Is there a way of using advanced filter for this rather than a formula?

Thankyou
 

Attachments

  • excel word filter.jpg
    excel word filter.jpg
    20.9 KB · Views: 14

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Welcome to the MrExcel board!

See if this is any use. In my sample the top table is "Table1" and the bottom table is "Table2"

LEFROGUE.xlsm
B
1
2Words to Filter:
3Men
4Male
5males
6
7
8
9Data set
10female
11men
12lament
13male
14menopause
15male
16mens
17
18
Sheet1


VBA Code:
Sub Fltr()
  ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=1, Criteria1:=Split(Join(Application.Transpose(Range("Table1[Words to Filter:]")))), Operator:=xlFilterValues
End Sub

Result:

LEFROGUE.xlsm
B
1
2Words to Filter:
3Men
4Male
5males
6
7
8
9Data set
11men
13male
15male
17
18
Sheet1
 
Upvote 1
Hi and welcome to MrExcel.

Is there a way of using advanced filter

With advanced filter use this. Notice that in cell C2 there is a formula.
Libro1
ABC
1DATA SETWords
2femaleFALSO
3men
4lament
5male
6menopause
7male
8mens
9tamales
10malestar
11males
Hoja1
Cell Formulas
RangeFormula
C2C2=ISNUMBER(SEARCH("|"&A2&"|","|Men|Male|males|"))


List range: $A$1:$A$11
Criteria range: $C$1:$C$2

Result:
Libro1
A
1DATA SET
3men
5male
7male
11males
Hoja1

--------------------​
Another option is with an auxiliary column and your table of words, then you only filter by column B those that are different from error:
Libro1
ABCD
1DATA SETAuxWords
2female#N/AMen
3men1Male
4lament#N/Amales
5male2
6menopause#N/A
7male2
8mens#N/A
9tamales#N/A
10malestar#N/A
11males3
Hoja2
Cell Formulas
RangeFormula
B2:B11B2=MATCH(A2,$D$2:$D$4,0)




--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
 
Upvote 1
Hi and welcome to MrExcel.



With advanced filter use this. Notice that in cell C2 there is a formula.
Libro1
ABC
1DATA SETWords
2femaleFALSO
3men
4lament
5male
6menopause
7male
8mens
9tamales
10malestar
11males
Hoja1
Cell Formulas
RangeFormula
C2C2=ISNUMBER(SEARCH("|"&A2&"|","|Men|Male|males|"))


List range: $A$1:$A$11
Criteria range: $C$1:$C$2

Result:
Libro1
A
1DATA SET
3men
5male
7male
11males
Hoja1

--------------------​
Another option is with an auxiliary column and your table of words, then you only filter by column B those that are different from error:
Libro1
ABCD
1DATA SETAuxWords
2female#N/AMen
3men1Male
4lament#N/Amales
5male2
6menopause#N/A
7male2
8mens#N/A
9tamales#N/A
10malestar#N/A
11males3
Hoja2
Cell Formulas
RangeFormula
B2:B11B2=MATCH(A2,$D$2:$D$4,0)




--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
Hi Dante,
Thanks for the help.

How do you do it if there are multiple words in first column e.g 'male pain' or 'symptoms of man flu'

How do you filter those out aswell?

Regards

James
 
Upvote 0
How do you do it if there are multiple words in first column e.g 'male pain' or 'symptoms of man flu'
Could you please give us a better representative set of sample data (with XL2BB) and also show us the expected results?

Did you try the vba suggestion that I made?
 
Upvote 0
excle mr.xlsx
BCD
2KeywordKeyword
3Dogsmenstrual breast pain
4menbreastfeeding pain
5malemastitis pain
6Goatmale mastitis
7Cowbreast pain
8Bovinebreast tenderness
9Foxesmenopause breast pain
10Catsfibrocystic breast disease
11Foxesmastalgia
12mastitis symptoms
13tender breast meaning
14nipple pain
15sternum pain
16boobs sore after period
17foxes mastitis
18pain under left breast
19sharp pain in left breast that comes and goes
20mastitis treatment
21engorgement
22breast abscess
23breast pain before period
24sharp pain in breast
25pain in middle of chest bone
26pain under breast bone above stomach
27pain under right breast
28men sore breast
29pain between breasts in center of chest
30sore boobs
31left breast pain
32breast pain causes
33sharp pain under left breast
34pain under my left breast and ribs
35sharp pain in breast that comes and goes
36right breast pain
37pain in upper stomach under breasts
38sharp pain under left breast that comes and goes
39bovine mastitis
40female chest pain left side above breast
41pain between breasts in center of chest female
42painful lump in breast
Sheet1


Hi Peter, here it is. Thanks for help
 
Upvote 0
Hi peter , have over 5000 lines of data for 30 data sets will take a while doing mannually. Tried the VBA you suggested, do not know how to use it. Would you mind using that mini sheet to use it please?
 
Upvote 0
You still have not given the expected results for that sample data in post #7. :(
I need that to be sure that I understand what it is you are trying to do. You are obviously very familiar with your data and requirement but we helpers have absolutely no idea other that what you show us and tell us in detail. :eek:
 
Upvote 0

Forum statistics

Threads
1,215,882
Messages
6,127,534
Members
449,385
Latest member
KMGLarson

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