I have a variable with email addresses. I want to create a new variable with just the email domain.
What formula can I use to extract the email domain?
The InStr function is probably your best ***. The sample code below extracts the e-mail domain from an e-mail address and displays it in a message box.
Dim sEMAddress As String
Dim sEMDomain As String
sEMAddress = "email@example.com"
Dim lAtSymbol As Long
lAtSymbol = InStr(1,sEMAddress,"@")
sEMDomain = Right(sEMAddress,Len(sEMAddress) - lAtSymbol + 1)
I hope that you find this helpful.
Without VB... in the long variable name of your new variable you can use something like this:
assuming your e-mail addresses are in v1 (first variable of the spreadsheet).
use var name as necessary, replace 20 at the end with appropriate lenght if you want, you know what to do ...