How To Get Domain from Emails

Learn how to efficiently extract domains from a list of email addresses using Google Sheets, including advanced techniques with REGEX and array formulas for automatic updates.

So you have a list of leads of email addresses and you wanna get the domain. This is great if you have an event that people are signing up for, you have a customer list that you wanna see the domains of your customers, the businesses they run. This is great if you have lots of them, like hundreds. Don't type it out. I'm gonna show you how to do this This is what you don't wanna do. You don't wanna go down the list and say Apple google.com, zapier .com. Don't do that If you wanna do this one time only and you don't wanna repeat this over and over again, you can highlight the C column here where I have all of the emails, go up to Data , and you're gonna split Text to Columns. Here you're going to go to Custom and you're gonna add the @ sign. And right away you see that these all turn into…

It actually splits it, leaves the name in the C column and puts the domain in the D column. That might not be the actual result you want. You might actually want to keep the email and just get the domain. So we're gonna use REGEX , not Match , not Replace, Extract. We're going to select the C2 column here. I'm gonna click X here so we can focus on this. And the regular expression you're gonna use is in quotes, so we'll have double quotes here. We're gonna put the @ sign And if you want to look at what that does, it just gets the at. We need actually the text behind it, right? So put in parentheses dot or period plus. And what this is saying in regular expressions or regex extract.

is get everything more than everything, all the characters after the @. And now I can copy and paste that all the way down, and I get all of the domains of my email address What if you want the domain name, meaning not the .com? Well, it's gonna be a little bit different. We'll use regular expression extract. Get that same text, put it in quotes. We're still gonna use that @ symbol And we're still gonna use parentheses. But inside the parentheses, we're gonna do square brackets. After the square brackets, we're gonna do a plus, and we're gonna use the caret which on a Mac is above the six, number six, and then a dot And what this does is it gets everything before that dot. So it's going pretty much from the @ symbol to the dot symbol.

and saying, "Get us all of that." This plus symbol is saying, "Get all of the characters in there." So there's how you can get the domain name and here's how you can get the whole domain And you can set this up automatically, especially if you're doing something like in a Google Forms or there's constantly new leads coming to this So I can delete all of these and up here in the first one, in this D2, instead of or in addition to this regular ex-tract, regular expressions extract I can wrap it with array formula When I wrap it with array formula , I do need to change the C2 to C2:C. Hit Enter, and now every single one is done. Even if I add more at the bottom, it's going to keep doing it.

I don't have to come back with that same formula again and again. This array formula takes care of it. Now, a couple downsides to this that you can't sort this… I mean, you can sort the list, but then this formula is gonna move around So a really fun trick with that is I'm gonna go into this formula . I'm gonna Command+X, cut, cut it. Now we have nothing. But up here in the header in D1, I'm gonna say equals, I'm gonna put curly brackets and a semicolon. Before the semicolon, I'm gonna add In quotes domain. After the semicolon, I'm gonna paste and delete that equal sign. And now in the header , in the first row, I have both the header and the formula.

that's applying to the entire sheet. Now, I think that's a really cool trick, and I hope you enjoyed that. Consider becoming a member to get way more out of your Google Sheets than you ever thought of before. Hope you enjoyed that one You're watching Better Sheets here on YouTube. Watch this video or this video. It's gonna make your Google Sheets better Go ahead, ask me anything down below in the comments . And I'm going to answer it in a future video become a member of Better Sheets today. . You get videos, you get sheets. So what do I have to do to get you into a brand new Google Sheet? Go buy some tools that I've built inside of Google Sheets doing things in Google Sheets you never thought possible. Go check it out.