TRIM Formula Generator (2026) — Remove Extra Spaces | Free Excel & Sheets

Removes all spaces from text except for single spaces between words.

Generated Formula
=TRIM(text)

Learning Resources

Want to master Excel? Check out this Top-Rated Course.

Common Errors & Fixes

  • TRIM not removing all spaces

    Causes:
    • Non-breaking spaces (CHAR(160)) are not removed by TRIM.
    • Line breaks or tab characters between words.
    Fixes:
    • Use SUBSTITUTE to replace CHAR(160) with space first, then TRIM.
    • Use CLEAN before TRIM to remove line breaks.

Frequently Asked Questions

Does TRIM remove line breaks?

No, TRIM only removes extra spaces between words and leading/trailing spaces. Use CLEAN to remove non-printing characters and line breaks.

What is the difference between TRIM and CLEAN?

TRIM removes extra spaces. CLEAN removes non-printable characters (line breaks, tabs, etc.). Use both: =TRIM(CLEAN(A1)) for thorough cleaning.

Does TRIM work in Google Sheets?

Yes, TRIM works identically in Google Sheets with the same syntax.

Want to become an Excel Pro?

Stop searching for formulas. Master Excel in 30 days with this top-rated course.

Learn More