Extract Vowels and Consonants Separately in Google Sheets

The easiest way to extract vowels and consonants separately in Google Sheets is by using the REGEXREPLACE function. Another option is the SUBSTITUTE function, but I find that formula a bit lengthy, so I prefer to use REGEXREPLACE.

The logic for extracting vowels and consonants is as follows:

  • To extract vowels from a text string, replace all the consonants with an empty string (“”).
  • To extract consonants, replace all the vowels with an empty string (“”). See the examples of how to do this in the formulas below.

Extracting Vowels from a Text String in Google Sheets

Assume cell A1 contains the English alphabet: abcdefghijklmnopqrstuvwxyz. The formula would extract the vowel letters aeiou. Note that I have provided both case-sensitive and case-insensitive formulas for this.

Case-Sensitive Formulas to Extract Vowels

  • Lowercase Vowels:
=REGEXREPLACE(A1,"[^aeiou]", "")

This will return “aeiou”.

  • Uppercase Vowels:
=REGEXREPLACE(A1,"[^AEIOU]", "")

This will return an empty string “”. If the alphabets in A1 are uppercase, it will return “AEIOU”.

These formulas are case-sensitive, meaning they treat lowercase and uppercase letters differently.

Case-Insensitive Formula to Extract Vowels

  • Lower/Upper/Proper Case Vowels:
=REGEXREPLACE(A1,"(?i)[^aeiou]", "")

Extracting Consonants from a Text String in Google Sheets

The formula to extract consonants is almost the same as the formula for extracting vowels. In the above example, we specified the character class for vowels. Here, instead, we will specify the consonants.

Case-Sensitive Formulas to Extract Consonants

Here, I have two separate formulas for lowercase and uppercase letters.

  • Lowercase Consonants:
=REGEXREPLACE(A1, "[^b-df-hj-np-tv-z]", "")
  • Uppercase Consonants:
=REGEXREPLACE(A1, "[^B-DF-HJ-NP-TV-Z]", "")

Case-Insensitive Formula to Extract Consonants

  • Lower/Upper/Proper Case Consonants: This is the recommended formula for removing vowels from a string and extracting the consonants.
=REGEXREPLACE(A1, "(?i)[^b-df-hj-np-tv-z]", "")

Additional Tip: Make a Regex Formula Case-Insensitive Using the LOWER Function

You can use the LOWER or UPPER functions to make a REGEX formula case-insensitive. For example, here’s how you can extract vowels using this method:

  • Vowel Extraction with Case Insensitivity:
=REGEXREPLACE(LOWER(A1),"[^aeiou]", "")

Simply wrap the cell reference with the LOWER function.

Now, for extracting consonants:

  • Consonant Extraction with Case Insensitivity:
=REGEXREPLACE(LOWER(A1), "[^b-df-hj-np-tv-z]", "")

Please note that this will convert the result to lowercase letters since we are using the LOWER function. If you use UPPER instead, it will convert the result to uppercase letters. However, when using UPPER, make sure to use the uppercase character class as well.

You can visit my Google Sheets function guide to explore more REGEX functions.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Extract Numbers from Text in Excel with Regex

You can use the REGEXEXTRACT or REGEXREPLACE functions to easily extract numbers from text...

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

How to Use OFFSET and XMATCH Functions Together in Excel

We often use the OFFSET and XMATCH functions together to match a value in...

How to Calculate Maximum Drawdown in Excel and Google Sheets

You can use the following dynamic array formula to calculate maximum drawdown (MDD) in...

More like this

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

Running Count with Structured References in Google Sheets

Running a count with structured references is achievable in Google Sheets tables using the...

Running Total with Structured Table References in Google Sheets

You can use two types of formulas to create a running total with structured...

4 COMMENTS

    • Hi, Julia,

      The following formula will highlight the cell A2 if the first two letters in this cell are consonants.

      =len(regexreplace(left(A2,2),"[aeiou]",))=2

      The same formula can be used for the range A2:A too. There are no changes in the formula.

      Best,

  1. Hi, thanks for this.

    Any way to do it without space.

    E.g. Green Mango > GrnMng

    How about if I would like to get the Initials.

    E.g. Green Mango > GM

    Thanks!

    • The below formula would return the required consonants without space.

      =REGEXREPLACE(A1,"(?i)[aeiou ]", "")

      To extract the initials, that means the first letter in each word, use the following formula.

      =regexreplace(proper(A1), "[^A-Z]", "")

      Best,

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.