Autofilter numeric wildcard alternative

lutsi

New Member
Joined
Mar 25, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need help with an autofilter function.

I want to filter out all cells in following format:

ABC001ABC

The first 3 characters are always some random letters, character 3 and 4 are random numbers between 0-9, and the characters afterwards doesn't matter what they are.

I've tried variations of the code below, but since numeric wildcards doesn't work in autofilter I'm out of ideas..
.Columns(1).Resize(, lCol).AutoFilter Field:=2, Criteria1:="???##*", Operator:=xlFilterValues

Maybe It's possible to use greater and less than operators but I don't know how to implement it properly in the autofilter code.

Thanks in advance.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Anthony47

Well-known Member
Joined
Mar 29, 2006
Messages
2,147
For sure after adding a helper column; in a free column insert the formula
Excel Formula:
=--MID(B2,4,2)
Then copy down

This new column will contain numeric values that you can use for your filters

Or via a macro...

With the existing data you may filter using the criteria "Starts with" ???3, and this will return ABC32xxx, CDE33jjjj,... but not ABC03kkk, A3300xxx etc

Bye
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,130,210
Messages
5,640,872
Members
417,174
Latest member
diegomuser

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
Top