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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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:
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,255
Members
448,556
Latest member
peterhess2002

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