CLEAN Function in Excel: Remove Non-Printing Characters

CLEAN Function in Excel: Remove Non-Printing Characters featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 28 September 2026

TextLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Common errors and fixes
  6. CLEAN in practice
  7. Where you will use it
  8. Worked example
  9. Mistakes people make
  10. Related functions
  11. Continue learning

CLEAN removes invisible control characters (like line breaks from system exports) that break lookups and look like spaces.

Advertisement

Syntax

=CLEAN(text)
Argument What it means
text Text to clean.

Examples

Example 1

=TRIM(CLEAN(A2))

The standard clean-up for pasted data.

Example 2

=SUBSTITUTE(A2, CHAR(10), ", ")

Keep the content but turn line breaks into commas.

Common errors and fixes

You see Why, and the fix
Still does not match Non-breaking spaces (CHAR 160) are printable β€” replace them with SUBSTITUTE(A2,CHAR(160),” “).

CLEAN in practice

Where you will use it

  • Remove line breaks from data pasted from PDFs or ERP
  • Fix lookups failing due to hidden characters
  • Tidy text before splitting

Worked example

Raw textFormulaResult
Invoice 1045=CLEAN(A2)Invoice1045
GST IN=CLEAN(A3)GSTIN
Plain=CLEAN(A4)Plain

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
Expecting it to remove non-breaking spacesCLEAN removes codes 0-31 only; use SUBSTITUTE(A2,CHAR(160)," ")
Not trimming afterwardsUse TRIM(CLEAN(A2)) to also tidy spaces

TRIM Β· SUBSTITUTE Β· CHAR

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

πŸ“Ž Practice files for this article

  • πŸ“—
    Practice workbook: Text & cleaning24 tasks on realistic sales data β€” type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX Β· 35 KB

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong