Quick Answer

CLEAN Function

Strips non-printable control characters from text.

✓ Excel✓ Google SheetsExcel All versions

Syntax

CLEAN
(text)

Parameters

ParameterDescriptionRequired
textThe text or cell reference from which to remove non-printable characters.Required

Basic Example

Remove a non-printable prefix

=CLEAN(CHAR(9) & "Data")
ResultData

CHAR(9) is a tab (a non-printable control character) that CLEAN strips, leaving "Data".

Advanced Examples

Example 1: Clean imported data

Cell A1 has hidden line-feed characters from a CSV export

Strip control codes before matching

=CLEAN(A1)
Result: Text without control characters
Removing codes 0-31 prevents lookup mismatches caused by invisible characters.

Example 2: Combine with TRIM

Data has both control chars and extra spaces

Remove non-printables and normalize spaces

=TRIM(CLEAN(A1))
Result: Cleaned, single-spaced text
CLEAN removes control characters, then TRIM collapses extra spaces.

How CLEAN Works

CLEAN scans the string and deletes characters whose code points fall in the 0-31 control range. It does not remove printable characters or, by default, characters above 31.

1
Find dirty text
Locate cells with imported or copy-pasted text.
2
Wrap with CLEAN
Enter =CLEAN(cell) and press Enter.
3
Pair with TRIM
Use =TRIM(CLEAN(cell)) to also fix spacing.

Important Notes & Limitations

  • Only removes characters 0-31; it does not strip all Unicode control or format characters.

  • Excel 2016+ adds an optional second argument for cleaning additional character sets, but the classic form uses one argument.

  • Does not remove printable junk like extra spaces (use TRIM for that).

Common Errors & Fixes

Still mismatched lookupsCLEAN removed control chars but extra spaces remain.

Fix: Wrap the result in TRIM as well: =TRIM(CLEAN(cell)).

Download Practice File

Practice CLEAN with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the CLEAN function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

What characters does CLEAN remove?
Non-printable control characters with codes 0 through 31 (and code 127 in Google Sheets).
Why combine CLEAN with TRIM?
CLEAN handles control characters; TRIM removes extra spaces so the text matches cleanly.
Does CLEAN remove line breaks I want?
Yes, line feeds (code 10) are removed; if you need them, keep them before cleaning or substitute them back.