Excel Formula to Extract Text Between a Period and @
Question details
Extract a variable-length last name or other text between a period and the @ symbol in an email address using a dynamic formula.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Email addresses are stored in a worksheet column, and the user wants to extract the name portion before the @ symbol.
- Observed behavior
- The extracted text should update automatically when the source address changes, including when names have different lengths.
Check which column contains the email addresses and whether the part before @ can contain multiple periods. The examples below assume the first address is in cell A2.
Extract text after the first period with MID and FIND
Use this formula when the part of each email address before @ contains one period.
Select an empty cell such as B2 and enter =IFERROR(MID(A2,FIND(".",A2)+1,FIND("@",A2)-FIND(".",A2)-1),"").
Press Enter, then drag the fill handle from B2 down alongside the remaining email addresses.
Extract text after the last period with TEXTAFTER
Use this option when the part before @ may contain multiple periods and your Excel version supports TEXTBEFORE and TEXTAFTER.
Extract Last Names with a Formula in WPS Spreadsheets
Use MID and FIND in WPS Spreadsheets to extract text between the first period and @. The result updates when the email address changes.
- 1. Open the worksheet: Open your Excel workbook in WPS Spreadsheets and locate the email addresses in column A.
- 2. Enter the formula: Select B2 and enter =IFERROR(MID(A2,FIND(".",A2)+1,FIND("@",A2)-FIND(".",A2)-1),"").
- 3. Fill the remaining rows: Press Enter, then drag the fill handle from B2 down to extract text from the other addresses.
- 4. Save the workbook: Choose File > Save As and select an Excel format such as XLSX if you need to share the workbook with Excel users.

Frequently Asked Questions
Will the extracted name update if the email address changes?
Yes. A formula in B2 that references A2 recalculates when A2 changes, provided workbook calculation is enabled.
What happens if an address has no period before @?
The IFERROR formulas above return a blank. Without IFERROR, FIND or TEXTAFTER can return an error when the delimiter is missing.
How do I extract only the text after the last period?
In a supported version of Excel, enter =IFERROR(TEXTAFTER(TEXTBEFORE(A2,"@"),".",-1),"") in an empty cell. The -1 argument selects the last period before @.
Can I use Flash Fill instead of a formula?
You can enter an example result and choose Data > Flash Fill, but Flash Fill is not dynamic and may not handle addresses without last names consistently.




