Cellgrids Cellgridsby LearnWithRinkesh
Home › Excel tutorials › Extract Text Before or After a Character in Excel

How to Extract Text Before or After a Specific Character in Excel

By Rinkesh Shah · Business Analyst, 8 years in data · Updated 2026-10-31

▶ Video coming soon

You often need part of a text: the username from an email, the code before a dash, or the domain after the @ sign.

Modern way: TEXTBEFORE and TEXTAFTER

In Microsoft 365 and Excel 2024 you can write:

For priya@example.com these return priya and example.com.

Classic way: LEFT, RIGHT, FIND, LEN

These work in every version of Excel.

FIND gives the position of the character. LEFT takes everything up to just before it. RIGHT takes everything after it, using LEN to work out how many characters remain.

Example: SKU codes

For LAP-2045-BLK, =TEXTBEFORE(A2, "-") returns LAP. To get the second part, use =TEXTBEFORE(TEXTAFTER(A2, "-"), "-"), which returns 2045.

If the character is missing

FIND returns #VALUE! when the character is not in the cell. Wrap it with IFERROR to show the original text instead: =IFERROR(LEFT(A2, FIND("@", A2)-1), A2).

To split into several columns at once, see TEXTSPLIT or the Text to Columns tool.

Worked example

A2 holds "asha@mail.com". Before the @: =LEFT(A2,FIND("@",A2)-1) returns asha. After the @: =MID(A2,FIND("@",A2)+1,100) returns mail.com. In Microsoft 365: =TEXTBEFORE(A2,"@").

Common mistakes

Frequently asked questions

What if the character appears more than once?

Give FIND a start position or use TEXTBEFORE with an instance number.

FIND or SEARCH?

FIND is case sensitive. SEARCH is not and accepts wildcards.

Is there a no-formula way?

Yes. Flash Fill or Text to Columns.

Practice this online, free

Reading is only half of learning Excel. Cellgrids is a free place for online Excel practice: solve Excel formula exercises in a live spreadsheet, prepare for Excel interview questions, and work through business case studies built for data analytics and business analytics roles.

Practice these formulas: TEXTBEFORE, TEXTAFTER, LEFT, FIND.

Start Excel practice → Case studies