To find out what this character is, we can use the CODE function. Type this function into the cell B2: =CODE (LEFT (A2)). Since the character is in the first position in the text, we can easily find out its code using the LEFT function. In this case, we get the result as “160”. There is a limited array of non-alphanumeric characters available in Excel. In the Formatting Palette open the Add Objects section then click the Symbols button. The most extensive availability of characters is provided by the OS X Character Viewer (or Character Palette, depending on your version of the OS). Inserting Other Special Characters. Where a special character isn't available through the long-press method, described above, OS X provides the Keyboard and Character Viewers to allow you select and insert individual special characters. The easiest way of accessing either of these two viewers is by enabling the Menu bar shortcut.
We know that TRIM and CLEAN Excel functions are used to clean up unprintable characters and extra spaces from strings but they don't help much in identifying strings containing any special character like @ or ! etc. In such cases we use UDFs.
So if you want to know if a string contains any special characters, you will not find any Excel formula or function to do so. We can find the special characters that are on the keyboard by manually typing but you can't know if there are symbols in the string or not.
Finding any special characters can be very important for data cleaning purposes. And in some cases, it must be done. So how do we do this in Excel? How can we know if a string contains any special characters? Well, we can use UDF to do so.
The below formula will return TRUE if any cell contains any characters other than 1 to 0 and A to Z (in both cases). If it does not find any special characters it will return FALSE.
Generic Formula
=ContainsSpecialCharacters(string) |
String: The string that you want to check for special characters.
For this formula to work, you will need to put the code below in the module of your workbook.
So open Excel. Press ALT+F11 to open VBE. Insert a module from the Insert menu. Copy the code below and paste it into the module.
Now the function is ready to be used.
Go to the worksheet in the workbook that contains the strings that you want to check.
Go to the worksheet in the workbook that contains the strings that you want to check.
Write the below formula in cell C2:
=ContainsSpecialCharacters(B13) |
It returns TRUE for the first string since it contains a special character. When you copy the formula down it shows FALSE for B14 string and so on.
But strangely it shows TRUE for the last string 'Exceltip.com'. It is because it contains a dot (.). But why so? Let's examine the code to understand.
How does the function work?
Excel Find Special Character
We are iterating through all the characters of the string using the For loop and mid function of VBA. The Mid function extracts one character at a time from string and stores it into ch variable.
Now the main part comes. We use the select case statement to check what the ch variable contains.
We tell VBA to check if ch contains any of the defined values. I have defined 0 to 9, A to Z, a to z and ' ' (space). If c
h contains any of these, we set it's value to False.
h contains any of these, we set it's value to False.
You can see that we don't have a dot (.) on the list and this is why we get TRUE for the string that contains dot. You can add any character to the list to be exempt from the formula.
If ch contains any character other than the listed characters, we set the function's result to True and end the loop right there.
So yeah this how it works. But if you want to clean special characters, you will need to make some changes in the function.
How to Clean Special Characters From Strings in Excel?
Excel For Mac Find Special Characters Free
To clean special characters from a string in Excel, I have created another custom function in VBA. The syntax of the function is:
=CleanSpecialCharacters(string) |
This function returns a cleaned version of the string passed into it. The new string will not contain any of the special characters.
The code of this function goes like this:
Copy this in the same module you copied in the above code.
When you use this formula on the strings this is how the results will be:
You can see every special character is removed from the string including the dot.
How does it work?
It works the same as the above function. The only difference is this function replaces every special character with a null character. Forms a new string and returns this string.
If you want to exempt any character from getting cleaned, you can add it to the list in the code. Excel will pardon that special character.
So yeah guys, this is how you can find and replace special characters from a string in Excel. I hope this was explanatory enough and helpful. If it doesn't help you in solving your problem, let us know in the comments section below.
Related Articles:
How to Use TRIM function in Excel: The TRIM function is used to trim strings and clean any trailing or leading spaces from string. This helps us in the cleaning process of data a lot.
How to use the CLEAN function in Excel: Clean function is used to clean up unprintable characters from the string. This function is mostly used with the TRIM function to clean up imported foreign data.
Replace text from end of a string starting from variable position: To replace text from the end of the string, we use the REPLACE function. The REPLACE function uses the position of text in the string to replace it.
How to Check if a string contains one of many texts in Excel: To find check if a string contains any of multiple text, we use this formula. We use the SUM function to sum up all the matches and then perform a logic to check if the string contains any of the multiple strings.
Count Cells that contain specific text: A simple COUNTIF function will do the magic. To count the number of multiple cells that contain a given string we use the wildcard operator with the COUNTIF function.
Excel REPLACE vs SUBSTITUTE function: The REPLACE and SUBSTITUTE functions are the most misunderstood functions. To find and replace a given text we use the SUBSTITUTE function. Where REPLACE is used to replace a number of characters in string…
Popular Articles:
50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make you work even faster on Excel.
How to use Excel VLOOKUP Function| This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.
How to use theExcel COUNTIF Function| Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.
How to Use SUMIF Function in Excel| This is another dashboard essential function. This helps you sum up values on specific conditions.
How to find and replace asterisk / question mark / tilde in Excel?
When you work with an Excel file, you want to find the cells which contain asterisk, question mark or tilde and replace the specific characters with other values. Most of you may consider directly entering the asterisk (*), question mark (?) or tilde (~) character into the Find text box and replace them. But in this way, you will get the wrong result. This article, I will talk about how to find and replace asterisk / question mark / tilde in Excel quickly and correctly.
Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
Find and replace asterisk / question mark / tilde in Excel
Amazing! Using Efficient Tabs in Excel Like Chrome, Firefox and Safari!
Save 50% of your time, and reduce thousands of mouse clicks for you every day!
To find and replace these specific characters, you need to add a character tilde (~) before the asterisk, question mark or tilde in the Find what text box, please do with the following steps:
Excel Special Characters List
1. Select the range cells that you want to replace the specific characters.
2. Go to click Home > Find & Replace > Replace or you can press Ctrl + H shortcuts to open the Find and Replace dialog, see screenshot:
3. In the Find and Replace dialog box, enter~* into the Find what text box to find the cells which have the * character, and then type the value which you want to replace with in Replace with text box, see screenshot:
4. Then click Replace All button in the dialog, and all asterisks have been replaced with the value you want.
5. At last, close the Find and Replace dialog box.
Note: If you need to replace the question mark or tilde characters, you just enter ~? or ~~ into the Find what text box.
Related articles:
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
- Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
- Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
- Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
- Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
- Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
- Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
- Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
- Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
- More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
Excel Replace All Special Characters
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
- To post as a guest, your comment is unpublished.This does not work in WPS Office. How to find and replace a 'tilde' symbol in WPS Office?
- To post as a guest, your comment is unpublished.Thank you! This was so helpful.