Spreadsheet Practice

CLEAN function

CLEAN removes non-printing characters, such as line breaks and tabs, from text. Use it on data pasted from other systems, where hidden characters make cells look identical but fail to match, or push text onto a second line.

Available in
Every current version
Category
Text functions
Returns
Text with the non-printing characters (codes 0 to 31) removed.

Syntax

=CLEAN(text)

ArgumentRequired?What it is
textRequiredThe text or cell to clean.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
D2=CLEAN(A2)Maya ChenThe trailing line break is gone
D3=LEN(C3)-LEN(CLEAN(C3))1One hidden character found in the code
D4=CLEAN(B4)5 Elm RdUnit BRemoving a line break joins the words; use SUBSTITUTE if you need a separator

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
Imported nameAddressCodeResult
Maya Chen 12 Oak St Apt 4WDG-01Maya Chen
Raj Patel88 Pine AveGDT-02 1
Lee Wong5 Elm Rd Unit BGZM-035 Elm RdUnit B

Practice CLEAN

Graded instantly, then re-checked on changed data.

Strip hidden characters

The names in column A came from another system with hidden line breaks, tabs and spaces. In B2, remove the non-printing characters and the extra spaces. Fill down to B6.

Common mistakes

What you seeWhy, and how to fix it
Nonbreaking spaces remainCLEAN only removes codes 0 to 31. The nonbreaking space (160) survives; replace it with SUBSTITUTE(A2,CHAR(160)," ").
Words run togetherDeleting a line break doesn't add a space, so "Rd" and "Unit B" become "RdUnit B". Swap the break for a space instead: =SUBSTITUTE(A2,CHAR(10)," ").

Tips

  • Pair it with TRIM: =TRIM(CLEAN(A2)) handles most messy imports in one step.

Questions

What does CLEAN do in Excel?

It strips non-printing characters (codes 0 to 31), such as line breaks, tabs and carriage returns, from text.

How do I remove line breaks in Excel?

Use =CLEAN(A2) to delete them, or =SUBSTITUTE(A2,CHAR(10)," ") to turn each break into a space so words don't run together.

Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.