Advanced Filter with wildcards, Excel 2013

redrockmtn

New Member
Joined
Dec 6, 2017
Messages
7
[FONT=&quot]I have an Excel list with many websites. Some end in .com, .net, .org. But some end in .com.mx, .fr, .ru. How do I do an advanced filter to remove all .com.mx, .fr, and .ru while keeping all .com, .net, and .org?[/FONT]
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
redrockmtn,

If the list exists in Column A, then try:

Code:
Sub Test()

    ActiveSheet.AutoFilterMode = False
 
        ActiveSheet.Range("$A$1").AutoFilter Field:=1, Criteria1:=Array( _
            ".fr", ".com.mx", ".ru"), Operator:=xlFilterValues
        
            If ActiveSheet.AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible).Cells(1, 1).Value <> "" Then
                ActiveSheet.Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeVisible).EntireRow.Delete
            End If
    
    ActiveSheet.AutoFilterMode = False
    
End Sub
 
Last edited:
Upvote 0
Where do I enter this code? I was thinking of using the "advanced filter" in Excel.


redrockmtn,

If the list exists in Column A, then try:

Code:
Sub Test()

    ActiveSheet.AutoFilterMode = False
 
        ActiveSheet.Range("$A$1").AutoFilter Field:=1, Criteria1:=Array( _
            ".fr", ".com.mx", ".ru"), Operator:=xlFilterValues
        
            If ActiveSheet.AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible).Cells(1, 1).Value <> "" Then
                ActiveSheet.Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeVisible).EntireRow.Delete
            End If
    
    ActiveSheet.AutoFilterMode = False
    
End Sub
 
Upvote 0
it shouldn't
*.com should show anything ending in .com
*.com* should show anything containing .com
 
Upvote 0
It doesn't. I just tested it again.

[TABLE="width: 128"]
<colgroup><col span="2"></colgroup><tbody>[TR]
[TD]websites[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]0123movies.com[/TD]
[/TR]
[TR]
[TD="colspan: 2"]01net.com[/TD]
[/TR]
[TR]
[TD="colspan: 2"]104.com.tw[/TD]
[/TR]
[TR]
[TD="colspan: 2"]1111.com.tw[/TD]
[/TR]
[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD="colspan: 2"]

[TABLE="width: 64"]
<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]websites[/TD]
[/TR]
[TR]
[TD]*.com[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

it shouldn't
*.com should show anything ending in .com
*.com* should show anything containing .com
 
Upvote 0
This is under the "data" tab, in "sort and filter" section, and "Advanced filter." Excel 2013. It requests for list range and criteria range.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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