VBA & Macro Problems

How to Delete Excel Cells Containing Three Consecutive Consonants

Huda QurayshiHuda Qurayshi Nov 10, 2026 868 views

Question details

The user needs a method to identify and remove or filter out cells that contain words with three or more consecutive consonants.

How to Delete Excel Cells Containing Three 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 you start

Before running macros or complex array formulas, ensure you have backed up your spreadsheet data to prevent accidental loss of information.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 to open the Visual Basic for Applications (VBA) editor in Excel.

2
Enable Regular Expressions

Go to Tools > References in the top menu, scroll down to find and check 'Microsoft VBScript Regular Expressions 5.5', then click OK.

3
Insert a New Module

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.

4
Run the Macro

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.

Use a VBA Macro to Clear Cells in Excel
Handling Special Characters: The pattern [^aeiouAEIOU] matches any character that is not a vowel, which inherently includes spaces, numbers, and punctuation. To target only alphabetical consonants, use a stricter pattern like (?i)[bcdfghjklmnpqrstvwxyz]{3}.

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. 1. Open your Spreadsheet: Launch WPS Spreadsheet and open your workbook containing the text data.
  2. 2. Access Developer Tools: Navigate to the Developer tab to access the VBA Editor and enable the Regular Expressions reference.
  3. 3. Run Macro or Formula: Apply your regex formula or paste the VBA script to instantly clear the targeted cells.
Fully compatible with Microsoft Excel (.xlsx, .xls, .csv) formats.Robust support for advanced formulas and dataset filtering.Built-in developer tools for running VBA macros to automate data cleanup.Lightweight and fast performance even with large datasets.
microsoft office alternative - wps office

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.