TRIM Function in Excel: Remove Extra Spaces

📎 This article includes 1 downloadable practice file ↓

⏱ 1 min readUpdated 28 September 2026

TextLevel: BeginnerAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Power combo
  5. Common errors and fixes
  6. Related functions

TRIM removes leading and trailing spaces and reduces multiple spaces between words to one. Essential after copying data from websites and ERPs.

Syntax

=TRIM(text)
Argument What it means
text Text to clean.

Examples

Example 1

=TRIM(A2)

” Asha Verma ” → “Asha Verma”.

Power combo

=TRIM(SUBSTITUTE(A2, CHAR(160), " "))

Also removes non-breaking spaces from web data, which TRIM alone leaves behind.

Common errors and fixes

You see Why, and the fix
Lookup still fails after TRIM Non-breaking spaces (CHAR 160) or line breaks (CHAR 10) remain. Use the combo above and CLEAN.

CLEAN · SUBSTITUTE · LEN

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

📎 Practice files for this article

  • 📗
    Text-cleaning scenarios workbookExtract and clean text (GSTIN, PAN, emails, names) with PASS/FAIL checks, plus the 3 mistakes that break text formulas.
    ⬇ XLSX · 8 KB

Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong