ExcelTool.io

TRIM

Removes leading, trailing, and repeated internal spaces from text.

Syntax

=TRIM(text)

Arguments

  • text - The text to clean.

Examples

=TRIM(A2)

Returns: A2 with extra spaces collapsed to single spaces

The fix for lookups that fail because of trailing spaces.

Common Errors and Gotchas

  • TRIM leaves single spaces between words - it only removes extras.
  • It does not remove non-breaking spaces (CHAR(160)) common in web-pasted data; use SUBSTITUTE for those.

Does TRIM Work in Google Sheets?

Yes. TRIM uses the same syntax in Google Sheets and LibreOffice Calc, so you can paste these formulas straight across.