HomeGoogle DocsSpreadsheetExtract Username from Email Address Using Regex in Google Sheets

Extract Username from Email Address Using Regex in Google Sheets

Published on

When you want to extract Username from email address, in Google Sheets there are multiple options. Here I’m using REGEXREPLACE formula to do this. Also, there is another variant using LEFT and FIND combination. That combination also you can experiment below.

An Email Address or Email ID has three parts. The first part is the username or local_part, then the @ symbol and finally the user domain.

Whatever formula you are going to use to extract Username from email address, you should consider the second part of the email address. That is the @ symbol. Based on this there are two options in front of you. You can either extract the username directly or replace the domain with space. The result would be the same. Here, I’m following the second approach.

Extract Username from Email Address in Google Sheets

First I’m going to use REGEXREPLACE formula for this purpose.

Regex Formula to Extract Username from Email Address

regexreplace to extract username from email address

Here is the formula:

=REGEXREPLACE(A1,"@(.*)","")

This regex formula replaces the second and third part of the Email Address with Space. So you would be left with the username only.

When you want to extract email address from an entire column, you can use the above same formula but with ArrayFormula.

=ArrayFormula(REGEXREPLACE(A1:A,"@(.*)",""))

Left and Find Formula Combination to Extract Username from Email Address

You can use the below combination of Left and Find functions as an alternative to REGEXREPLACE.

=left(A1,find("@",A1)-1)

Here also you can use it with ArrayFormula.

=ArrayFormula(left(A1:A,find("@",A1:A)-1))

Extract Username from Email Address [BCC or CC List]

As a bonus, I’m going to provide you with another awesome formula. When you have a long list of email addresses, that is comma separated, in a cell, you may want to extract all the usernames at a time.

This situation may arise when you have received the list copied from BCC or CC of your Email. See the below image first.

left and find combination to extract username from email id in google sheets

And the formula here is;

=proper(join(", ",ArrayFormula(left(ArrayFormula(TRIM(split(A1,","))),
find("@",ArrayFormula(TRIM(split(A1,","))))-1))))

Here I’ve used a few more functions like Proper, Trim, Split and Join.

That’s all. Hope some of you will find the above formulas useful. For me, I’ve never faced such situations to extract users’ name from email IDs. But I know, there are many people who want to know how to do this extraction.

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.

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

Excel Word Count: Beyond SUBSTITUTE

You might want to count the number of words in a cell in Excel...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

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.