CLEAN Function

Removes non-printing characters such as line breaks from text.

Category

Text

Available in

All versions, Microsoft 365

Returns

Text

Taught hands-on in Level 4: Advanced Dynamic Arrays & Logic - Advanced Math & Text module

Overview

CLEAN strips out the invisible control characters (codes 0–31) that sneak in from other systems — line breaks, tabs and odd symbols.

Pair it with TRIM to clean imported text in one step.

Syntax

=CLEAN(text) Explain

Arguments

ArgumentRequired?What it does
textYesThe text or cell to clean.

Examples

Example 1 — Removing line breaks

Addresses exported with line breaks inside a single cell show up on several lines.

=CLEAN(A2) Explain

The line breaks disappear — but so do the gaps they made, so words can run together.

Example 2 — Swap line breaks for commas instead

Keep the parts separated.

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

Example 3 — The standard clean-up

Use both together on imported data.

=TRIM(CLEAN(A2)) Explain

Common mistakes

  • Character 160 and others. CLEAN only removes codes 0–31. Non-breaking spaces (160) and some Unicode characters need SUBSTITUTE.

Notes

Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.