# CLEAN formula generator

> Describe what you need and get a CLEAN formula for Excel and Google Sheets, run on real data before you copy it. Plus 3 tested CLEAN examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/clean · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

CLEAN removes non-printing characters, such as line breaks and tabs, from text.

Describe the task at [CLEAN formula generator](https://spreadsheetpractice.com/tools/formula-generator/clean) and get a CLEAN formula for Excel and Google Sheets, tested on real data.

## Tested CLEAN examples

### Remove non-printing characters

`=TRIM(CLEAN(A2))`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/remove-non-printing-characters)

### Why is my IF formula not matching text that looks the same

`=IF(TRIM(B2)="Paid","Closed","Chase")`

Excel. Result on the sample sheet: 6 rows (C2:C7). [See it and try it](https://spreadsheetpractice.com/formulas/if-not-matching-text-that-looks-the-same)

### Remove line breaks from cells

`=TRIM(SUBSTITUTE(A2,CHAR(10)," "))`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/remove-line-breaks-from-cells)

## Questions

### What does the CLEAN formula generator do?

You describe the task in plain English, and it writes the formula, using CLEAN where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does CLEAN do?

CLEAN removes non-printing characters, such as line breaks and tabs, from text.

### Can I learn to write CLEAN formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the CLEAN function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
