What it does
TRIM removes extra spaces and CLEAN removes many non-printing characters.
Syntax or pattern
=TRIM(text) / =CLEAN(text)5 practical examples
Remove extra spaces
Clean a name imported with double spaces.
=TRIM(A2)TRIM keeps single spaces between words.
Clean imported text
Remove non-printing characters.
=CLEAN(A2)Useful after copying from systems or PDFs.
Use both together
Clean messy imported text.
=TRIM(CLEAN(A2))A strong first cleanup step.
Fix lookup values
Clean a lookup value before matching.
=XLOOKUP(TRIM(A2),Products[Code],Products[Name])Hidden spaces often break lookups.
Clean full column with table reference
Apply cleanup to a table column.
=TRIM(CLEAN([@Name]))Works well in helper columns.
Common mistakes to avoid
- Not handling missing delimiters.
- Forgetting that some text functions return text, not numbers.
- Using fixed positions when the text layout is not consistent.
Related Excel examples
FAQ
Can text formulas work with Excel Tables?
Yes. Table references can make text-cleaning formulas easier to understand.
Here are some ideas for you
Optional resources that may help if you are learning formulas, building reports, or working in spreadsheets often.
- Excel formula booksSee ideas
Practice formulas with structured examples you can keep beside your desk.
- Excel shortcut guidesSee ideas
Build speed with keyboard shortcuts for selection, formatting and navigation.
- Numeric keypadsSee ideas
Helpful if you enter many numbers on a laptop or compact keyboard.
- External monitorsSee ideas
Useful for viewing large worksheets, formulas and reference tables side by side.
- Desk notebooksSee ideas
Sketch formula logic, report ideas and table structures before building.
- Laptop standsSee ideas
Make long spreadsheet sessions more comfortable and ergonomic.
Some links in this section may be affiliate links. Choose only what is useful for your own work.