TRIM Function: syntax, examples, mistakes and translation notes
Removes extra spaces from text.
Syntax
=TRIM(text)
Arguments
text
Text whose ordinary extra spaces should be normalized.
Worked examples
=TRIM(" CellLingo tools ")
Returns “CellLingo tools”.
=TRIM(A2)
Removes leading/trailing ordinary spaces and collapses repeated spaces.
Practical tips
- TRIM is useful for imported data before lookups.
- Non-breaking spaces from web pages may require SUBSTITUTE as well.
- Use CLEAN when control characters are also present.
Common mistakes
- Assuming TRIM removes every Unicode whitespace character.
- Cleaning displayed text but forgetting that the original dirty field is still used in the lookup.
Related functions
Frequently asked questions
What does TRIM do?
Removes extra spaces from text.
Why might a TRIM formula return an unexpected result?
Assuming TRIM removes every Unicode whitespace character. Start by testing the smallest referenced range or condition independently before adding wrappers or fallbacks.
Check the complete formula
Function syntax is only one part of a working workbook. Paste the finished expression into the Formula Checker for structural warnings, the Formatter for readability or the Translator when a supported locale mapping is involved.
Testing note: examples are educational. Spreadsheet versions, locale settings, tables, named ranges and workbook data can change behavior, so validate important formulas with representative data.