Remove multiple special characters excel
Many 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. Show
Download Practice WorkbookFor practice, you can download the practice book from the link below. 4 Methods for How to Remove Special Characters in ExcelWe will use the following dataset to explain the ways. The dataset contains the Names and Mail Addresses of clients of a company. You can notice Cell B8 contains a formula and it shows a non-printable value along with the name of the client 1. Removing Special Characters in Excel Using Excel FormulasExcel has useful formulas which you can use to remove special characters in Excel. They are formed using the functions like SUBSTITUTE, RIGHT, LEFT, CLEAN, TRIM and REPLACE. We will look into each of them one by one. a. Using the SUBSTITUTE FunctionLet us start with the SUBSTITUTE function. It is used to replace a character with another. Suppose you want to remove special characters from cell B5 of the given dataset. The formula to remove specific characters using SUBSTITUTE will be:
Here you can notice that the specific characters mentioned in the cell are removed. It works
sequentially. Hence, the character Again, you can remove recursive characters using instance numbers. The formula will be: Observe that the sequentially second However, you might want to remove all the characters keeping the name only. This time the formula will be nested SUBSTITUTE within itself. The formula will look like:
This shows the perfect result for this case. Formula Description: The syntax of the formula:
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. Special Case: The special characters contains code numbers and we can get their code number using the formula: or The RIGHT or LEFT function is used to get the location of the character whose code you want to get. Therefore this process includes two steps:
For the result, serially follow the pictures below along with formulas.
Moreover, if similar characters are found this process will remove both. Observe the results below.
b. Using RIGHT or LEFT FunctionsConsidering, you have already seen in the above way the use of RIGHT and LEFT functions. These can be used with the LEN function to remove specific characters in Excel. The formula will be: You can increase the values to any number and subtract it with LEN(text) to remove a specific amount of special characters. For this the formula is: Similarly for LEFT formula, And for increment of instance number, the changed formula: Formula Description: The syntax of the formula:
text= the text from where you want to remove characters. num_chars= number of characters to be removed. text= the text whose length you want to count. -1 or -(any number) is the number of characters you want to subtract from the total number of characters in a text. c. Using CLEAN and TRIM FunctionsYour dataset might contain non-printable characters and extra space as well. CLEAN and TRIM functions can be used to remove them. The formula for removing non-printable character is: To remove non-printable characters along with extra spaces you can use the formula: Nevertheless, you can do both by nesting TRIM and CLEAN with SUBSTITUTE. The formula will look like:
Follow the picture below. Formula Description: The syntax of the individual formula: Here, text= the text from where you want to remove the non-printable character. text= the text from where the extra space needs to be removed.
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. d. Using the REPLACE FunctionFurther, there is another formula using the REPLACE function to remove a specific amount of characters after a number of characters. The formula is:
Here the formula is pretty much similar to SUBSTITUTE. It takes 2 more arguments named start_num ( the number from which the characters need to be removed). num_chars ( the number of characters to be removed). And it does not take text as an argument which is needed for SUBSTITUTE. The formula for the given dataset is to remove special characters after “#Sen“. Read more: How to Remove Specific Characters in Excel 2. Use of Flash Fill to Remove Special Characters in ExcelMoving on with Excel tools. The Flash Fill is the easiest way to remove special characters in Excel. Let us say we have names and mail addresses of clients in the same column and those are separated by a comma. We want to remove the texts after the comma including the comma. Follow the steps to know how to use the Flash Fill to remove special characters in Excel.
Read more: How to Remove Blank Characters in Excel 3. Use of the Find & Replace Command to Remove Special CharactersAnother useful tool of Excel is Find & Replace. Suppose we want to remove “Mailto:” before the address in the column named Mail Address of the dataset. Follow the steps below to remove special characters using Find & Replace.
You will see the result as follows. Read more: How to Remove Spaces in Excel: With Formula, VBA & Power Query 4. Removing Special Characters Using the Power Query ToolCertainly, 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.
A new window named Power Query Window will open.
Formula:
A new column will be created and your new formula will be shown in the formula bar of the window.
You will find a new worksheet in your workbook where you will see the final result as shown here. You can notice this process did not remove the “^^” characters from cell D7. It is because Excel considers the character within the category of “. .” character. Things to RememberUnfortunately, 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. ConclusionThe article described 4 different ways to remove special characters in Excel. We have used Excel formulas and tools to explain the 4 different ways of removing special characters in Excel. to do this. In short, the formulas include functions like SUBSTITUTE, CLEAN, RIGHT, CODE, and so on. On the other hand, the tools used are Flash Fill, Find & Replace and Power Query. I hope this article was helpful to you. For any further queries, write in the comment section. Related Articles
How do you remove all asterisk characters from cells in Excel?Remove Asterisks (*). In the Ribbon, go to Home > Find & Select > Replace (or use the keyboard shortcut CTRL + H).. In the Find what box, enter “~*” (tilde and asterisk), and click Replace All. ... . You get the pop-up message with information on how many replacements are made (32 for this example).. |