Remove Text After a Character in Excel (Keep the Start)
By ExcelReady TeamUpdated 7 min read
The short answer
To remove text after a character in Excel, keep only the part before it. In Microsoft 365 or Excel 2024, use =TEXTBEFORE(A2,"-"). In any version, use =LEFT(A2,FIND("-",A2)-1): FIND gets the position of the dash and LEFT keeps the characters before it. For a one-off clean-up, use Find and Replace with -* and an empty Replace box.
Key takeaways
- =TEXTBEFORE(A2,"-") keeps everything before the first dash; it needs Microsoft 365 or Excel 2024.
- =LEFT(A2,FIND("-",A2)-1) does the same in every version. Drop the -1 to keep the dash itself.
- Use an instance number, like =TEXTBEFORE(A2,"-",-1), to cut at the last dash instead of the first.
- Both formulas return an error when the character is missing, so wrap them in IFERROR or use TEXTBEFORE's if_not_found argument.
- Find and Replace with -* removes the text for good, with no formula left behind.
On this page+
- Which method should you use?
- How to remove text after a character with TEXTBEFORE
- How to remove text after a character with LEFT and FIND
- How to remove text after the last or the second delimiter
- Remove text after a comma, space, @ or bracket
- What if the character isn't in the cell?
- How to remove text after a character without a formula
- Practise it
To remove text after a character in Excel, you keep the start of the cell and drop everything from the character onwards. The quickest formula is TEXTBEFORE in Microsoft 365 or Excel 2024; in older versions, LEFT with FIND does the same job. This guide shows both, plus a no-formula method, for product codes, email addresses, city names and anything else with a dash, comma, @ or space in the middle.
Which method should you use?#
Pick a formula if the data will change or you want to keep the original column, and Find and Replace if you only need to clean the data once. Here is the short version:
| Method | Works in | Result | Best for |
|---|---|---|---|
=TEXTBEFORE(A2,"-") | Microsoft 365, Excel 2024 | Live formula | The easiest formula |
=LEFT(A2,FIND("-",A2)-1) | Every version | Live formula | Files shared with older Excel |
Find and Replace with -* | Every version | Text is changed in place | One-off clean-ups |
| Flash Fill (Data > Flash Fill) | Excel 2013 and later | Typed values | Quick, irregular patterns |
All the examples below use these product codes in A2:A6:
| A | |
|---|---|
| 1 | Product Code |
| 2 | Laptop-15-Silver |
| 3 | Monitor-27-Black |
| 4 | Keyboard-UK-White |
| 5 | Mouse-Wireless-Grey |
| 6 | Dock-USBC-Black |
How to remove text after a character with TEXTBEFORE#
TEXTBEFORE returns the text that comes before a delimiter, which is the character or text you split at. In B2, type:
=TEXTBEFORE(A2,"-")The result is Laptop. Fill it down (Windows: Ctrl+D; Mac: ⌘D) and you get Monitor, Keyboard, Mouse and Dock. The full syntax is:
=TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])Only the first two parts are required. The others are optional:
- instance_num picks which dash to cut at.
2means the second dash, and-1means the last one. - match_mode set to
1ignores capital letters, which matters only when the delimiter is a word. - if_not_found is what to show when the delimiter is missing, instead of #N/A.
TEXTBEFORE needs Microsoft 365 or Excel 2024. In older versions it shows #NAME?. The guide to TEXTBEFORE and TEXTAFTER covers the mirror function, TEXTAFTER, which keeps the end instead.
How to remove text after a character with LEFT and FIND#
In any version of Excel, combine FIND, which returns the position of a character, with LEFT, which keeps a number of characters from the start:
=LEFT(A2,FIND("-",A2)-1)Work through it for Laptop-15-Silver:
FIND("-",A2)returns 7, because the dash is the 7th character.7-1is 6, the number of characters before the dash.LEFT(A2,6)returns Laptop.
The -1 is what removes the character itself. To keep the dash and drop only what comes after it, leave it out: =LEFT(A2,FIND("-",A2)) returns Laptop-.
FIND is case-sensitive and SEARCH is not. For a dash, comma or @ the choice doesn't matter, but for a letter or a word it does. The article on FIND and SEARCH in Excel explains the difference, and the LEFT function guide and FIND function guide give the full syntax. For a side-by-side look at the two approaches, read LEFT vs TEXTBEFORE.
How to remove text after the last or the second delimiter#
To cut at a later delimiter, give TEXTBEFORE an instance number. Positive numbers count from the start and negative numbers count from the end:
| Formula | Result for Laptop-15-Silver |
|---|---|
=TEXTBEFORE(A2,"-") | Laptop |
=TEXTBEFORE(A2,"-",2) | Laptop-15 |
=TEXTBEFORE(A2,"-",-1) | Laptop-15 |
With two dashes, the second dash and the last dash are the same one. With a code like SKU-1042-BLK-L, =TEXTBEFORE(A2,"-",-1) returns SKU-1042-BLK, which removes only the size at the end.
Older Excel has no instance number, so the formula is longer. This version replaces the last dash with a ~ and then finds the ~:
=LEFT(A2,FIND("~",SUBSTITUTE(A2,"-","~",LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))))-1)LEN(A2)-LEN(SUBSTITUTE(A2,"-","")) counts the dashes, and SUBSTITUTE swaps only that last one. For SKU-1042-BLK-L it also returns SKU-1042-BLK. Pick a swap character that never appears in your data.
Remove text after a comma, space, @ or bracket#
The same formulas work with any delimiter. Just change the text in quotes, and include a space in it when the data has one:
| Text in A2 | Formula | Result |
|---|---|---|
| Paris, France | =TEXTBEFORE(A2,",") | Paris |
| maria.lopez@northwind.com | =TEXTBEFORE(A2,"@") | maria.lopez |
| Invoice 2291 (paid) | =TEXTBEFORE(A2," (") | Invoice 2291 |
| Jordan Price | =LEFT(A2,FIND(" ",A2)-1) | Jordan |
If you split at "(" instead of " (", the result is Invoice 2291 followed by a space. You can't see it, but it stops lookups and COUNTIF from matching. Either include the space in the delimiter or wrap the formula in TRIM: =TRIM(TEXTBEFORE(A2,"(")).
To pull out a piece from the middle instead, such as the 15 in Laptop-15-Silver, see how to extract text between two characters.
What if the character isn't in the cell?#
Both formulas return an error when the delimiter is missing: TEXTBEFORE gives #N/A and FIND gives #VALUE!. A single code without a dash can break a whole column. Decide what you want instead, usually the original text:
=TEXTBEFORE(A2,"-",,,,A2)
=IFERROR(LEFT(A2,FIND("-",A2)-1),A2)The first uses TEXTBEFORE's sixth argument, if_not_found. The commas skip the optional arguments you don't need. The second wraps the older formula in IFERROR. Both return the whole cell when there's no dash, so Webcam stays Webcam.
How to remove text after a character without a formula#
Find and Replace can delete everything after a character in one go, using the * wildcard, which matches any number of characters:
- Select the column. If you skip this, Excel replaces across the whole sheet.
- Press Ctrl+H (Mac: Control+H) to open Replace.
- In Find what, type
-*. In Replace with, type nothing. - Click Replace All.
Laptop-15-Silver becomes Laptop. To keep the dash, replace -* with -. This changes the cells themselves, so copy the column first or press Ctrl+Z (Mac: ⌘Z) straight away if it goes wrong. Find and Replace can't target the last dash, so use a formula for that. For other ways to strip characters, such as removing every dash or the first few characters, read how to remove characters in Excel.
Practise it#
Practise TEXTBEFORE and TEXTAFTER in a live spreadsheet: you split emails, names and file paths and the sheet checks each formula as you type. Then practise FIND and SEARCH to build the LEFT and FIND version that works in every Excel. Or start with the exercise on this page: one product code, one formula.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Each product code starts with the product name, then a dash. In B2, keep only the text before the first dash in A2 with LEFT and FIND, then press Enter.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Product | |||
| 2 | Laptop-15-Silver | |||
| 3 | Monitor-27-Black | |||
| 4 | Keyboard-UK-White | |||
| 5 | Mouse-Wireless-Grey | |||
| 6 | Dock-USBC-Black | |||
| 7 | ||||
| 8 | ||||
| 9 |
Tip: FIND("-",A2) gives the position of the dash. Take 1 away so LEFT stops just before it.
Practise this in a lesson
Frequently asked questions
How do I remove everything after a character in Excel?
Use =TEXTBEFORE(A2,"-") in Microsoft 365 or Excel 2024, or =LEFT(A2,FIND("-",A2)-1) in any version. Replace the dash with your own character, such as a comma, @ or space.
How do I remove text after the last occurrence of a character?
In Microsoft 365 or Excel 2024, give TEXTBEFORE a negative instance number: =TEXTBEFORE(A2,"-",-1). It counts from the end, so it cuts at the last dash.
How do I delete text after a character without a formula?
Select the column, press Ctrl+H, type the character followed by an asterisk (like -*) in Find what, leave Replace with empty and click Replace All. The asterisk matches everything after the character.
Why does my LEFT and FIND formula return #VALUE!?
FIND returns #VALUE! when the character is not in the cell. Wrap the formula in IFERROR to keep the original text: =IFERROR(LEFT(A2,FIND("-",A2)-1),A2).
Can I keep the character and remove only what comes after it?
Yes. Leave out the -1: =LEFT(A2,FIND("-",A2)) keeps the text up to and including the dash.