Filter Macro where cell contains

Domroy

Board Regular
Joined
Mar 8, 2018
Messages
114
Hi there,

I have a sheet with 1500 records I'm trying to match to another sheet that has 700 records. The company name is not an exact match, so VLOOKUP is not an option. I built a tool with a macro for an advanced filter, and one to clear the data. The problem is that my filter is only looking up the company name if it STARTS with the text I put in my input cell. I want it to find it if it's anywhere in the column, not just the beginning. For example, if I put "National" in the designated lookup cell, I want it to find anywhere where "National" is in the company name field, not just at the beginning. Here's the code I used:

Code:
Sub Filter_Data()
'
' Filter_Data Macro
'


'
    Application.ScreenUpdating = False
    Application.CutCopyMode = False
    Range("List").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range( _
        "Criteria"), Unique:=False
End Sub
Sub Reset_Filter()
'
' Reset_Filter Macro
'


'
    Application.ScreenUpdating = False
    Range("A4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("A4:XFB4").Select
    Range(Selection, Selection.End(xlToLeft)).Select
    Range("A4:N4").Select
    Selection.ClearContents
    Application.CutCopyMode = False
    Range("List").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range( _
        "Criteria"), Unique:=False
    Range("A4").Select
End Sub

Can you help me fix it so it finds the data wherever it's located in the cell?

Thank you!

Judi
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try putting the keyword between 2 asterisk, like this:
*National*
 
Upvote 0
Try putting the keyword between 2 asterisk, like this:
*National*

OH!!! As in, in my search box? YES! I will try that tomorrow when I get to work and let you know. Thanks so much! I always forget about those...
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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