We can remove text in Excel by matching the content. This can be done with the SUBSTITUTE function. The steps below will walk through the process.
Figure 1: Result for Removing Text by Matching
Syntax to Remove Text by Matching
=SUBSTITUTE(text, text_to_remove,"")
Formula
=SUBSTITUTE(A4,"-","")
Setting up the Data to Remove Text by Matching
We will input phone numbers into Column A from Cell A4 to Cell A9. Column B will contain the results.
Figure 2: Setting up the Data
Remove Text by Matching
We will remove the hyphens (-) from the phone numbers in Column A by following the steps below:
- We will click on Cell B4
- We will input the formula below into the cell
=SUBSTITUTE(A4,"-","")
- We will press the enter key to get the result
Figure 3: Result for Removing Text by Matching for Cell A4
- We will drag the fill handle from Cell B5 to Cell B9 to copy the formula into those cells and get the result
Figure 4: Result for Removing Text by Matching
Explanation
=SUBSTITUTE(text, text_to_remove,"")
In this formula, the SUBSTITUTE function supplies the text that is contained in the cell. It requests that excel removes the hyphen (text to remove) and the inverted commas serve as the new text without the hyphen that has been removed. It is this new text that is returned as the output.
How to Remove More than one Character
We can nest the SUBSTITUTE function to remove more than one character. The generic formula to do this is:
=SUBSTITUTE(SUBSTITUTE(text,text_to_remove_1,””),text_to_remove2,””)
- We will add brackets to the previous data used.
Figure 5: How to Remove More than one Character
We will do the following to ensure that we have only the numbers as the output.
- We will click on Cell B4
- We will input the formula below into the cell
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A4,"-",""),"(",""),")","")
- We will press the enter key to get the result
Figure 6: How to Remove More than one Character
- We will drag the fill handle from Cell B5 to Cell B9 to copy the formula into those cells and get the result
Figure 7: Result of Removing More than one Character
Explanation
The operation starts with the nested SUBSTITUTE function. Excel removes text_to_remove_1 first. It then proceeds to the outer SUBSTITUTE function and removes text_to_remove_2.
Instant Connection to an Expert through our Excelchat Service
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.
Leave a Comment