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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
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.

websites
0123movies.com
01net.com
104.com.tw
1111.com.tw


websites
*.com

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>

<colgroup><col span="2"></colgroup><tbody>
</tbody>

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,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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