Function · Text

Excel CLEAN function

The Excel CLEAN function removes characters 0 through 31, including a line break. It does not remove a nonbreaking space, character 160.

All current Excel versions. Also in Excel for the web and Google Sheets.

Syntax =CLEAN(text)

CLEAN
=CLEAN("Austin"&CHAR(10)&"TX")

Arguments

NameRequiredWhat to pass
textRequiredThe text to strip. Codes 0 through 31 are removed. Printable characters, including ordinary spaces, stay.

Examples

A line break between Austin and TX

=CLEAN("Austin"&CHAR(10)&"TX")

Result AustinTX

=CLEAN("Austin"&CHAR(10)&"TX")B2
Clean
AB
1RawAustin, then a line break, then TX
2CleanedAustinTX
A picture of the sheet, not a live calculator. CHAR(160), the nonbreaking space from some web exports, is still there after CLEAN.

CLEAN deletes the nonprinting characters whose codes are 0 through 31. A line break is character 10, so Austin, a line break, and TX become AustinTX. The function does not insert a space where the line break was. If the two words should stay apart, put a space in the text yourself.

It does not touch character 160, the nonbreaking space that shows up in text copied from web pages. It does not collapse ordinary spaces either. TRIM does the spaces. SUBSTITUTE does a specific character CLEAN refuses. The two are often nested: TRIM of a CLEAN of a SUBSTITUTE.