CLEAN
Removes non-printable ASCII control characters from text.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=CLEAN(text)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
text | any | Required | — |
Return type
Can return text.
Remarks
- Characters with codes
0..31are removed. - Printable whitespace like regular spaces is preserved.
- Non-text inputs are coerced to text before cleaning.
- Errors are propagated unchanged.
Examples
Remove a line-feed control character embedded between letters.
Formula =CLEAN("A"&CHAR(10)&"B")
Expected result AB
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Remove tab and carriage-return characters while preserving the letter.
Formula =CLEAN(CHAR(9)&"A"&CHAR(13))
Expected result A
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Cleaning an empty string gives an empty string.
Formula =CLEAN("")
Expected result ""
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
An input error propagates before any cleaning can occur.
Formula =CLEAN(1/0)
Expected result #DIV/0!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Printable spaces remain
Formula =CLEAN("A B")
Expected result A B
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Does CLEAN remove normal spaces or only control characters?
It removes only ASCII control characters (0-31); regular printable spaces remain.