Auto Filter Question

jac3130

Board Regular
Joined
Dec 21, 2012
Messages
131
I have a large table of data. In column B, are the names of people in the table formatted "Last name, First name." I have over 1,000 people in the table. At times, I get a list of 10-15 people to look up. Instead of scrolling through and finding the names, I'd like to use the autofilter already set.

I'm wondering- is there a macro where I could type in a name to the macro and it would automatically autofiler on the names typed in? I suppose I'd like an approximate match (no need to be exact). Also, some of the names I type might not yet be in the table so it'd have to account for this.

A lot of talented people on here, I have a feeling this can be done. If it can't, please let me know why as it will be a good learning experience.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Certainly helpful but the reason I thought VBA on this was to get the approximate match. I think the link's advice will only take exact matches.
 
Upvote 0
Have you tried recording a macro while filtering for an approximate match? That should give you some VBA code that you could edit to suit.
 
Upvote 0
Here's the code I get when I record the macro:

Code:
Sub CustomAutoFilter()
'
' CustomAutoFilter Macro
'
'
    ActiveSheet.Range("$A$4:$AI$1314").AutoFilter Field:=2, Criteria1:=Array( _
        "Last name, first name" , "Last name 2, first name 2", etc.), Operator:=xlFilterValues
End Sub

I've gotten read of the names for confidentiality purposes. Please help me figure this out.
 
Upvote 0
Jac, I think you could do something like this (not speaking from expertise here):
Code:
ActiveSheet.Range("$A$4:$AI$1314").AutoFilter Field:=2, Criteria1:=Array( _
    "Last name, *" , "Last name 2, *", etc.), Operator:=xlFilterValues
I have to assume that we are not dealing with misspelled names, but nicknames, middle initials (or not), etc.
 
Upvote 0
It's giving me a syntax error. I'm trying to type (only showing part of the code)
Code:
Criteria1:Array( _ "Last name, *","Last name 2, *"
Trying to get only approximate matches.
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,943
Members
448,534
Latest member
benefuexx

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