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
- Add a helper column beside the text column with the formula =CLEAN(A2), adjusted to the text column.
- Copy the helper column down, then check that the cleaned values look right.
- Copy the helper column and use Paste Special, Values, over the original text column.
- Delete the helper column, then test a lookup or filter on a value that failed before.
- 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.
