
The CLEAN function deletes nonprintable characters in a value, more specifically, it is designed to delete the first 32 nonprinting characters in 7-bit ASCII code.
The Unicode character set has additional nonprinting characters (values 127, 129, 141, 143, 144 and 157), however, the CLEAN function does not delete these characters.
Formula in cell D3:
=CLEAN(B3)
The picture above shows ANSI codes for each character so you easily can spot the characters that the CLEAN function can delete.
For example, ANSI character 29 is deleted by the CLEAN function above, 29 is among the first 32 nonprinting characters in 7-bit ASCII code.
1. CLEAN Function Syntax
CLEAN(text)
Back to top
2. CLEAN Function Arguments
text |
Required. A value from which you want to remove nonprintable characters |
Back to top
3. CLEAN Function example

This example demonstrates the CLEAN function, the image above shows a formula in cell D3 that removes nonprintable characters from cell B3.
Cell B3 contains these characters in ANSI code: 53, 52,29, and 66. Character 29 in ANSI is removed and only 53, 52, and 66 are now left in cell D3.
Nonprintable characters are the first 32 in 7-bit ASCII code.
Formula in cell D3:
=CLEAN(B3)
Back to top
4. CLEAN function - array

The image above demonstrates a formula that removes nonprintable characters in an array.
Formula in cell B3:
=CLEAN({"54B";"AB"})
Explaining formula
CLEAN({"54B";"AB"})
returns
{"54B";"AB"}
Back to top
5. CLEAN function - string

Excel 365 dynamic array formula in cell D3:
=TEXTSPLIT(CLEAN(B3),,";")
Explaining formula
Step 1 - Remove nonprintable characters
CLEAN(B3)
Step 2 - Split values into an array
TEXTSPLIT(CLEAN(B3),,";")
Back to top
6. Check if a cell contains nonprintable characters

Formula in cell D3:
=CLEAN(B3)<>B3
Explaining formula
Step 1 - Remove nonprintable characters
CLEAN(B3)
Step 2 - Get source value
B3
Step 3 - Check if not equal
CLEAN(B3)<>B3
Back to top
7. Check if a list contains nonprintable characters

Formula in cell D3:
=OR(CLEAN(B3)<>B3)
Explaining formula
Step 1 - Remove nonprintable characters
CLEAN(B3)
Step 2 - Get source value
B3
Step 3 - Check if not equal
CLEAN(B3)<>B3
Step 4 - Apply OR logic
OR(CLEAN(B3)<>B3)
Back to top
8. Highlight cells containing nonprintable characters

Conditional Formatting Formula:
=CLEAN(B3)<>B3
Explaining formula
Step 1 - Remove nonprintable characters
CLEAN(B3)
Step 2 - Get source value
B3
Step 3 - Check if not equal
CLEAN(B3)<>B3
How to apply Conditional formatting

- Go to tab "Home" on the ribbon.
- Press with left mouse button on the "Conditional Formatting" button, a popup menu appears.
- Press with left mouse button on "New Rule...", and a dialog box shows up.
- Enter the formula described below the image above.

- Press with left mouse button on the "Format..." button, a new dialog box appears.
- Pick a "Fill" color.
- Press with left mouse button on OK button to dismiss the dialog box.
- You are now back to the first dialog box.
- Press with left mouse button on the "OK" button to dismiss this dialog box as well.

Back to top
Functions in this article
Functions in 'Text' category
The CLEAN function function is one of many functions in the 'Text' category.
Returns an array of text values from a given cell range.
Converts full-width (double-byte) characters to half-width (single-byte) characters.
Converts a number to the corresponding ANSI character determined by your computers character set.
Deletes the first 32 nonprinting characters in 7-bit ASCII code in your argument.
Returns the corresponding number for the first character based on your computers character set. (PC- ANSI)
Concatenates values from multiple cells.
Joins text strings.
Checks if two values are precisely the same, it returns TRUE or FALSE. The EXACT function also considers upper case and lower case letters.
Returns the position of a specific string in another string, reading left to right. Note, the FIND function is case-sensitive.
Extracts a specific number of characters always starting from the left.
Returns the number of characters in a cell value.
Converts a value to lower case letters.
Returns a substring from a string based on the starting position and the number of characters you want to extract.
Substitutes a part of a text string based on the number of characters and length with a text string you provide.
Repeats a specific text a chosen number of times.
Extracts a specific number of characters always starting from the right.
Returns the number of the character at which a specific character or text string is found reading left to right (not case-sensitive)
Replaces a specific text string in a value. Case sensitive.
Returns a text value if the argument is a text value.
Converts a value to text in a specific number format.
Extracts a string after a specific substring in a given value.
Extracts a string before a specific substring from a given value.
Combines text strings from multiple cell ranges.
Splits a string into an array based on delimiting values.
Deletes all blanks or space characters except single blanks between words in a cell value.
Calculates a character based on a Unicode number.
Returns a Unicode number based on a character.
Converts a value to upper case letters.
Converts a text string that represents a number to a number.
Returns a value in text form. Text values are unmodified and non-text values are converted to text.
Excel function categories
Excel functions that let you resize, combine, and shape arrays.
Functions for backward compatibility with earlier Excel versions. Compatibility functions are replaced with newer functions with improved accuracy. Use the new functions if compatibility isn't required.
Perform basic operations to a database-like structure.
Functions that let you perform calculations to Excel date and time values.
Let's you manipulate binary numbers, convert values between different numeral systems, and calculate imaginary numbers.
Calculate present value, interest, accumulated interest, principal, accumulated principal, depreciation, payment, price, growth, yield for securities, and other financial calculations.
Functions that let you get information from a cell, formatting, formula, worksheet, workbook, filepath, and other entitites.
Functions that let you return and manipulate logical values, and also control formula calculations based on logical expressions.
These functions let you sort, lookup, get external data like stock quotes, filter values based a condition or criteria, and get the relative position of a given value in a specific cell range. They also let you calculate row, column, and other properties of cell references.
You will find functions in this category that calculates random values, round numerical values, create sequential numbers, trigonometry, and more.
Calculate distributions, binomial distributions, exponential distribution, probabilities, variance, covariance, confidence interval, frequency, geometric mean, standard deviation, average, median, and other statistical metrics.
Functions that let you manipulate text values, substitute strings, find string in value, extract a substring in a string, convert characters to ANSI code among other functions.
Get data from the internet, extract data from an XML string and more.
Excel categories
Latest updated articles.
More than 300 Excel functions with detailed information including syntax, arguments, return values, and examples for most of the functions used in Excel formulas.
More than 1300 formulas organized in subcategories.
Excel Tables simplifies your work with data, adding or removing data, filtering, totals, sorting, enhance readability using cell formatting, cell references, formulas, and more.
Allows you to filter data based on selected value , a given text, or other criteria. It also lets you filter existing data or move filtered values to a new location.
Lets you control what a user can type into a cell. It allows you to specifiy conditions and show a custom message if entered data is not valid.
Lets the user work more efficiently by showing a list that the user can select a value from. This lets you control what is shown in the list and is faster than typing into a cell.
Lets you name one or more cells, this makes it easier to find cells using the Name box, read and understand formulas containing names instead of cell references.
The Excel Solver is a free add-in that uses objective cells, constraints based on formulas on a worksheet to perform what-if analysis and other decision problems like permutations and combinations.
An Excel feature that lets you visualize data in a graph.
Format cells or cell values based a condition or criteria, there a multiple built-in Conditional Formatting tools you can use or use a custom-made conditional formatting formula.
Lets you quickly summarize vast amounts of data in a very user-friendly way. This powerful Excel feature lets you then analyze, organize and categorize important data efficiently.
VBA stands for Visual Basic for Applications and is a computer programming language developed by Microsoft, it allows you to automate time-consuming tasks and create custom functions.
A program or subroutine built in VBA that anyone can create. Use the macro-recorder to quickly create your own VBA macros.
UDF stands for User Defined Functions and is custom built functions anyone can create.
A list of all published articles.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form