The CLEAN function in Excel is a text function used to remove non-printable characters from text. These characters often appear when data is imported from external systems, databases, or copied from web pages.
Using CLEAN helps ensure your data is readable, printable, and ready for analysis.
What Does the CLEAN Function Do?
The CLEAN function removes the first 32 non-printable ASCII characters from a text string. These characters are invisible but can cause issues with printing, formulas, and data processing.
CLEAN Syntax
=CLEAN(text)
Argument Explained
- text – The text string from which you want to remove non-printable characters.
CLEAN Function Examples
Example 1: Remove Non-Printable Characters
=CLEAN(A2)
Removes hidden characters from the text stored in cell A2.
Example 2: CLEAN with Imported Data
=CLEAN(B2)
Useful when cleaning text imported from CSV files, web sources, or legacy systems.
Example 3: Combining CLEAN with TRIM
=TRIM(CLEAN(A2))
This removes both non-printable characters and extra spaces for fully cleaned text.
⬇ Download CLEAN Excel Template
Common Use Cases
- Cleaning imported or copied text data
- Preparing text for printing or reporting
- Fixing text errors caused by hidden characters
- Data preprocessing before analysis
CLEAN vs TRIM vs SUBSTITUTE
| Function | Purpose |
|---|---|
| CLEAN | Removes non-printable characters |
| TRIM | Removes extra spaces |
| SUBSTITUTE | Replaces specific characters |
Important Notes
- CLEAN removes only the first 32 ASCII non-printable characters
- It does not remove extra spaces (use TRIM for that)
- Works best when combined with other text functions
Conclusion
The CLEAN function is an essential tool for anyone working with imported or messy text data in Excel. It helps remove hidden characters that can cause formatting and calculation issues.
For best results, combine CLEAN with TRIM and SUBSTITUTE to fully sanitize your text data.