Skip to main content

CLEAN function


The CLEAN Function removes all non-printable characters from text.

Use CLEAN on text imported from other applications that contains characters that may not print with your operating system. For example, you can use CLEAN to remove some low-level computer code that is frequently at the beginning and end of data files and cannot be printed.




Text Required. Any worksheet information from which you want to remove non-printable characters.


The CLEAN function was designed to remove the first 32 non-printing characters in the 7-bit ASCII code (values 0 through 31) from text. In the Unicode character set, there are additional non-printing characters (values 127, 129, 141, 143, 144, and 157). By itself, the CLEAN function does not remove these additional non-printing characters.

CLEAN function can not remove spaces from text, if you want to remove spaces, please use TRIM function.


The example may be easier to understand if you copy the example data (include header) in the following table, and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.

Formula Result Description
=CLEAN(CHAR(11)&"Excel"&CHAR(11)) Excel Removes the non-printable character, CHAR(11).
=CLEAN(CHAR(12)&"Excel") Excel Removes the non-printable character, CHAR(12).
=CLEAN(CHAR(2)&" Excel") Excel Removes the non-printable character, CHAR(2).
=CLEAN(CHAR(127)&"Excel"&CHAR(127)) Excel Does not remove the non-printable character, CHAR(127). Can't see in HTML

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>