Excel Formula: Extract first and last name from e-mail address
This tutorial introduces the formulas to extract first name and last name from given email addresses into separate cells as below screenshot shown, also, it provides the example to explain the arguments and parts of the formulas.
Extract first name
Generic formula:
LEFT(e_address,FIND("separator",)-1) |
Arguments
E_address: the email address you want to extract the first name. |
Separator: the delimiter between first name and last name. |
How this formula work
To extract first name from the email address in cell B3, please use below formula:
=LEFT(B3,FIND("_",B3)-1) |
Press Enter key.
Explanation
FIND function: to find the start position of a character or text in a given text string. The formula FIND("_",B3) finds the position of character “_” in the cell B3, returns 4.
LEFT function: extract text from left side of the given text string based on the given text length. Formula LEFT(B3,FIND("_",B3)-1) can be seen as LEFT(B3,4-1), extract first 3 characters from the text in cell B3.
Extract last name
Generic formula
LEFT(RIGHT(e_address,LEN(e_address)-FIND("separacter",e_address)),FIND("@",RIGHT(e_address,LEN(e_address)-FIND("separator",e_address)))-1) |
Argument
E_address: the email address you want to extract the first name. |
Separator: the delimiter between first name and last name. |
How this formula work
To extract last name from the email address in cell B3, please use below formula:
=LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3)))-1) |
Press Enter key.
Explanation
FIND function: to find the start position of a character or text in a given text string.
LEN function: count the number of a text string.
RIGHT function: to extract text from right side.
The formula RIGHT(B3,LEN(B3)-FIND("_",B3)) can be seen as:
=RIGHT(B3,LEN(B3)-4)
=RIGHT(B3,17)
="Smith@kutools.com"
Then FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3))) can be seen as
=FIND("@","Smith@kutools.com")
="6"
LEFT function: extract text from left side of the given text string based on the given text length. The formula LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3)))-1) can be seen as these:
=LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),6-1)
=LEFT("Smith@kutools.com",5)
="Smith"
Remark
If you want to extract first and last name with first letter uppercase, you can add the PROPER function in the front of above formulas, such as:
=PROPER(LEFT(B3,FIND("_",B3)-1))
=PROPER(LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3)))-1))
Sample File
Relative Formulas
- Extract from right until character
Here introduces the formula to extract text from right side of a given text until a specified character. - Trim Text To N Words
Here introduces the formula to extract n words from left side of a text string. - Add leaing zeros to fix length
This tutorial provides formulas to add leading zero to make the text at the same length. - Add dashes to phone number
To add dashes to phone number, you can use a formula to solve it in Excel.
Relative Functions
- RIGHT function
Extract text from right side. - LEFT function
Extract text from left side of text string. - LEN function
Get the number of characters in the text. - SEARCH function
Find the position of a specific character or substring from the given text string. - FIND function
Find a string within another string
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.