New Tool Radar

AI for Data & Spreadsheets

How to Remove Hidden Characters from a CSV in Excel

Remove hidden characters from CSV text in Excel with CLEAN so lookups and filters match the values they should.

Schematic illustration for How to Remove Hidden Characters from a CSV in Excel: three numbered steps - Add a CLEAN helper column; Paste values over original; Test a lookup.

Text copied from a web page or another system can carry invisible characters that make two identical-looking values different to Excel, so a lookup fails for no visible reason. CLEAN removes the non-printable characters, and pasting the result as values makes the fix permanent.

Prerequisites

  • Excel
  • The CSV opened in Excel
  • A copy of the source file, so the original stays untouched.

Steps

  1. Add a helper column beside the text column with the formula =CLEAN(A2), adjusted to the text column.
  2. Copy the helper column down, then check that the cleaned values look right.
  3. Copy the helper column and use Paste Special, Values, over the original text column.
  4. Delete the helper column, then test a lookup or filter on a value that failed before.
  5. Save the file as .xlsx so the cleaned values are kept.

Worked example: Fictional product names after cleaning

The practice table below is a fictional five-product list after cleaning. The count column is 1 per product, and the total is the number of products. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.

Product Count
Mouse 1
Keyboard 1
Monitor stand 1
Webcam 1
Headset 1
Total 5

Expected result. Five products cleaned, each counted once, and a lookup on any product name now finds its row.

Limits

  • CLEAN removes only the first 32 non-printable characters, so a non-breaking space needs Find and Replace as well.
  • CLEAN also removes line breaks inside a cell, so check cells that should hold more than one line.

Sources

See all