You can use the following formula in Excel to remove characters after a dash in a cell:
This particular formula removes all characters after the dash (and including the dash) from cell A2.
The following example shows how to use this formula in practice.
Example: Remove Characters After Dash in Excel
Suppose we have the following dataset in Excel that contains a phrase that classifies various NBA teams as elite, great, good or bad:
Suppose we would like to remove all characters after the dash (and including the dash) from each cell in column A.
We can type the following formula into cell B2 to do so:
We can then click and drag this formula down to each remaining cell in column B:
Column B contains the text in column A with all of the text after the dash (including the dash) removed.
Bonus: Remove Characters After Second Dash
If you have a cell with multiple dashes and you’d like to remove the characters after the nth dash, you can specify a value for n as the third argument of the TEXTBEFORE function.
For example, you can use the following formula to remove all characters after the second dash in a cell:
=TEXTBEFORE(A2, "-", 2)
The following screenshot shows how to use this formula in practice:
Column B contains the text in column A with all of the text after the second dash removed.
Note: You can find the complete documentation for the TEXTBEFORE function in Excel here.
The following tutorials explain how to perform other common tasks in Excel: