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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

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,129,568
Messages
5,637,094
Members
416,957
Latest member
Brovashift

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