Excel

How to Use the CLEAN Function in Excel (Beginner’s Guide with Examples)

Have you ever copied data into Excel and noticed strange symbols, boxes, or formatting issues? These problems often come from non-printable characters—invisible codes that Excel doesn’t display properly.

The CLEAN function is designed to fix this. It removes non-printable characters from text, making your data clean, consistent, and easier to work with.


🔍 What is the CLEAN Function?

The CLEAN function removes all non-printable characters from text.

Syntax:

=CLEAN(text)
  • text → The cell or text string you want to clean.

💡 Note: CLEAN removes characters like line breaks, tabs, and control codes. However, it does not remove regular spaces—use it with TRIM to clean spacing issues.


✅ Example 1: Basic CLEAN

A1 Formula Result
“Hello␍World” =CLEAN(A1) HelloWorld
“Excel␊Tips” =CLEAN(A1) ExcelTips

✔️ Explanation: The original text contained line breaks or carriage return characters. CLEAN removed them, leaving only plain text.


✅ Example 2: Imported Data

Suppose you import data from a PDF or external system:

A1 Formula Result
“Product␍␊123” =CLEAN(A1) Product123
“Invoice␍␊#456” =CLEAN(A1) Invoice#456

✔️ Use case: CLEAN helps ensure product codes and invoice numbers are usable in formulas.


✅ Example 3: CLEAN with TRIM

Since CLEAN only removes non-printable characters, combining it with TRIM gives you extra power:

Formula:

=TRIM(CLEAN(A1))

✔️ Use case: Removes both unwanted characters and extra spaces → perfect for data cleaning.


✅ Example 4: Using CLEAN with SUBSTITUTE

Sometimes you want to remove line breaks (CHAR(10)) specifically.

Formula:

=SUBSTITUTE(CLEAN(A1), CHAR(10), "")

✔️ Explanation: SUBSTITUTE deletes any leftover line breaks after CLEAN, ensuring smooth text formatting.


🎯 Practical Uses of CLEAN

  1. Cleaning Imported Data → Fix errors from PDFs, web pages, or external systems.

  2. Removing Line Breaks → Convert multi-line cells into single-line values.

  3. Preparing Data for Lookups → Ensure VLOOKUP, INDEX, or MATCH work correctly.

  4. Avoiding Errors in Reports → Remove invisible characters that break formulas.


📝 Conclusion

The CLEAN function is a simple but powerful tool for removing non-printable characters in Excel. On its own, it solves many formatting problems. Combined with TRIM, it becomes a must-have formula for data cleaning.

👉 Next time your spreadsheet misbehaves, try CLEAN—it may solve the issue instantly.