IMany times the database contains some special characters which we do not need in the database and we want to remove them. We can easily perform this task with the help of Excel tools and formulas. The article will explain 4 different ways that will show how to remove special characters in Excel.
The following image shows an overview of the article which represents the removal of special characters in Excel.
Download Practice Workbook
Download this practice workbook to exercise while you are reading this article.
5 Ways to Remove Special Characters in Excel
In the following, I have described 5 simple ways to remove specific characters in Excel. Follow the instructions below.
Suppose we have a dataset containing some Employee ID and Name. But the name has some special characters inside it. Now we will remove those special characters using some simple tricks. Stay tuned!
1. Using Excel Functions to Remove Special Characters
1.1 Applying SUBSTITUTE Function
Let us start with the SUBSTITUTE function. It is used to replace a character with another.
- First, choose a cell (E5) and write the below formula down-
The syntax of the formula:
=SUBSTITUTE(text, old_text, new_text, [instance_num])
- text=the text which you want to work with.
- old_text= text which you want to remove.
- new_text= replaced text. ( For our case we replace it with blank “”).
- instance_name= the number of the special character in case of recursive characters present in the text.
- Gently hit ENTER and drag the “Fill Handle” down to fill.
- Finally, you will get the special characters removed from the cells. Simple isn’t it?
1.2 Combining RIGHT, and LEN Functions to Delete Special Characters
If you want to remove some characters from the right side then you can combine the RIGHT and LEN functions to delete characters from the right.
- Simply, choose a cell (E5) and apply the below formula down-
- The LEN function is providing the length of the texts.
- The RIGHT function returns a specific number of text counting from the right.
- Then hit the ENTER key and drag down the “Fill Handle”.
- In conclusion, you will get all the special characters from the right removed.
1.3 Utilizing LEFT, LEN Functions
Just like the previous sub-method you can remove special or any character from the left side with the help of LEFT and LEN functions.
- Similarly, choose a cell (E5) and write the below formula down-
- The LEN function is extracting the length of texts from the string.
- The LEFT function then removes 2 characters from the left and provides an output of #Sen.
- Hence, press ENTER key from the keyboard and pull the “Fill Handle” down to fill all the columns.
- In conclusion, you will get all the special characters removed from the left within a moment.
2. Implementing Flash Fill Feature to Remove Special Characters
Moving on with Excel tools. The Flash Fill is the easiest way to remove special characters in Excel.
Suppose we have a dataset with some special characters just like the following image. Let’s remove them using the Flash Fill feature.
- Now, select a cell (D5) and type “Sen” manually from the keyboard.
- Then choose another cell (D6) and hit the “Flash Fill” option from the Home Ribbon.
- In summary, you will see the excel flash fill feature has automatically filled the other cells in the column removing special characters.
Read more: How to Remove Blank Characters in Excel
3. Applying Find & Replace Feature
In some situations, the Find and Replace command can be your savior to erase special characters.
Suppose we have a dataset with some special characters in the Name column. Let’s erase those special characters and collect only the names in a new column.
- First, choose cells (C5:C11) and press CTRL+C to copy.
- Hence select cells (D5:D11) and hit CTRL+V to paste.
- Hence, selecting the pasted output use the keyboard shortcut CTRL+F to open the Find and Replace window.
- In the “Find what” box, type special characters “$&%” and leave the “Replace with” box blank.
- Finish the process by clicking “Replace All”.
- Within seconds, a confirmation window will pop up confirming all the replacements.
- In summary, we have successfully extracted the names removing all the special characters.
4. Using Power Query Tool to Eliminate Special Characters in Excel
Certainly, if you are using Microsoft Excel 2016 or Excel 365 then you can use Power Query to remove special characters in Excel. In case, you are using Microsoft Excel 2010 or 2013, you can install it from the Microsoft website. You can follow the steps to use Power Query to remove special characters from your dataset.
- First, select your range of data along with the header.
- Then choose From Table/Range from the Data
- Within a moment, you will find a small box. Check the range of your selected data and tick My table has headers
- After that, click OK.
- Thus, A new window named Power Query Window will open.
- Thereafter, select Custom Column from the Add Column tab in the Power Query
- Therefore, it will open the Custom Column Write “Output” in the New column name option. You can write any name you want.
- Then, write the formula below in the Custom column formula option-
- Afterward, hit the OK button.
- Thereafter, click Close & Load from the File tab of the window.
- Finally, you will find a new worksheet in your workbook where you will see the final result as shown here.
5. Applying VBA Code to Remove Special Characters in Excel
You can also apply VBA code to remove special characters from cells. In this VBA code first, we will define a user-defined function and then apply it to remove special characters. Follow the instructions to learn.
- First, open the worksheet and press ALT+F11 to open the “Microsoft Visual Basic for applications” window.
- Then inside the new module place the following code and click “Save”-
Function Erase_Special_Characters(Txt As String) As String Dim xx As String Dim yy As Long xx = "$&%" For yy = 1 To Len(xx) Txt = Replace$(Txt, Mid$(xx, yy, 1), "") Next Erase_Special_Characters = Txt End Function
In this section we’ll explain the VBA code used to remove specific characters in Excel.
- Now, coming back to the worksheet choose a cell (D5) and write the below formula down-
- Simply, hit the ENTER key and drag down the “Fill Handle” to fill.
- Finally, you will get all the special characters removed from the cells.
Things to Remember
- While using the flash fill feature to fill cells, the columns or rows have to be adjacent to each other. Otherwise, it won’t work.
- Unfortunately, if you are using Microsoft Excel versions older than 2010, you might not be able to install Power Query. You can use this feature only with versions 2010 to the latest.
- Anyway, all the methods have pros and cons so use them wisely according to your requirement.
In this article, I have tried to cover almost all the methods on how to remove special characters in Excel. Take a tour of the practice workbook and download the file to practice by yourself. I hope you find it helpful. Please inform us in the comment section about your experience. We, the Exceldemy team, are always responsive to your queries. Stay tuned and keep learning.
- How to Remove Characters in Excel (6 Methods)
- Remove First Character from String in Excel (6 Quick Ways)
- How to Remove Last Character in Excel(Easiest 6 Ways)
- How to Remove Characters from Left in Excel (6 Ways)
- Excel Remove Characters From Right (5 ways)
- How to Remove Non-numeric Characters from Cells in Excel
- How to Remove Space In Excel Before Numbers (3 Ways)