How to Delete Excel Cells Containing Three Consecutive Consonants
Question details
The user needs a method to identify and remove or filter out cells that contain words with three or more consecutive consonants.

- Product
- Excel, Google Sheets
- Device & OS
- not provided
- Scenario
- Cleaning up data or filtering a text list based on specific consonant patterns in a spreadsheet.
- Observed behavior
- Requires using regular expressions to match three consecutive non-vowel characters and clear the matched cells or filter the dataset.
Before running macros or complex array formulas, ensure you have backed up your spreadsheet data to prevent accidental loss of information.
Use a VBA Macro to Clear Cells in Excel
Utilize VBScript Regular Expressions within an Excel VBA macro to find and clear cells containing three consecutive consonants.
Since Excel formulas do not natively support regular expressions, using a VBA macro is the most effective way to clear cells matching this specific text pattern.
Press Alt + F11 to open the Visual Basic for Applications (VBA) editor in Excel.
Go to Tools > References in the top menu, scroll down to find and check 'Microsoft VBScript Regular Expressions 5.5', then click OK.
Click Insert > Module and write a script utilizing the RegExp object with the pattern "[^aeiouAEIOU]{3}" to iterate through your selected range and clear the matched cells.
Close the editor, select the range of cells you want to process in your worksheet, press Alt + F8, select your new macro, and click Run.

Filter Cells in Google Sheets Using REGEXMATCH
Use a combination of FILTER and REGEXMATCH functions to instantly filter out words with three or more consecutive consonants in Google Sheets.
Easily Manage Data and Macros with WPS Office
WPS Spreadsheet provides robust support for complex formulas, data filtering, and VBA macros. You can seamlessly run your Excel VBA scripts and regular expressions to clean your data directly within WPS.
- 1. Open your Spreadsheet: Launch WPS Spreadsheet and open your workbook containing the text data.
- 2. Access Developer Tools: Navigate to the Developer tab to access the VBA Editor and enable the Regular Expressions reference.
- 3. Run Macro or Formula: Apply your regex formula or paste the VBA script to instantly clear the targeted cells.

Frequently Asked Questions
Does the regex pattern [^aeiouAEIOU]{3} include spaces and numbers?
Yes, because it simply negates specific vowels, it will match any other character including numbers, spaces, and punctuation marks. If you only want alphabetic consonants, you should use an explicit consonant pattern instead.
Why isn't my VBA macro working in Excel?
Ensure you have enabled the 'Microsoft VBScript Regular Expressions 5.5' library in the VBA editor under Tools > References. Without this library enabled, the RegExp object will cause an error and fail to function.
Can I use REGEXMATCH natively in Excel formulas?
Currently, Microsoft Excel does not have a native REGEXMATCH function built into its standard formula library like Google Sheets does. You must rely on VBA or complex workarounds using built-in string functions.
Is 'Y' considered a vowel in this regex pattern?
By default, the pattern [^aeiouAEIOU] treats 'Y' as a consonant because it is not explicitly listed in the bracketed group of vowels. You can add 'Y' and 'y' to the list if you want it treated as a vowel.




