TRIM

    Text

    Removes all extra spaces from text, leaving only single spaces between words.

    Translations
    EnglishTRIM
    FrenchSUPPRESPACE
    SpanishESPACIOS
    GermanGLÄTTEN
    ItalianANNULLA.SPAZI
    PortugueseARRUMAR
    DutchSPATIES.WISSEN
    PolishUSUŃ.ZBĘDNE.ODSTĘPY
    RussianСЖПРОБЕЛЫ
    TurkishKIRP
    CzechPROČISTI
    HungarianTRIM
    SwedishRENSA
    DanishFJERN.OVERFLØDIGE.BLANKE
    FinnishPOISTA.TYHJÄT
    Syntax
    TRIM(text)

    Arguments

    • textThe text to clean up
    Examples
    =TRIM(" Hello World ")
    Hello World

    Removes leading, trailing, and extra spaces

    =TRIM(A1)
    Cleaned text

    Cleans up text from cell A1

    =TRIM(A1)=TRIM(B1)
    TRUE/FALSE

    Compare texts ignoring spaces

    Tips & Best Practices
    • Removes spaces at start, end, and between words
    • Leaves single spaces between words
    • Use CLEAN to remove non-printable characters
    Common Mistakes
    • Assuming TRIM only removes leading and trailing spaces - it also collapses multiple spaces between words down to one
    • Expecting TRIM to remove non-breaking spaces copied from a web page - those aren't regular spaces and TRIM leaves them alone
    • Running TRIM but not replacing the original data, so other formulas still reference the untrimmed version
    Related Functions
    CLEANRemoves non-printable characters that TRIM doesn't touch, useful together on messy pasted data
    SUBSTITUTECan remove non-breaking spaces (CHAR(160)) that TRIM can't handle on its own
    LENUseful for confirming TRIM actually shortened the text as expected
    Frequently Asked Questions

    Why doesn't TRIM remove all the extra spaces I see?

    Some pasted text contains non-breaking spaces, common when copying from web pages, which look identical but aren't the character TRIM removes. Use SUBSTITUTE(A1,CHAR(160)," ") first.

    Does TRIM remove spaces in the middle of text?

    It reduces multiple consecutive spaces between words down to a single space, but doesn't remove the single spaces that belong there.

    Do I need to replace the original data after using TRIM?

    Yes - TRIM returns a new value in the formula cell, it doesn't modify the source cell. Copy and paste as values if you want to replace the original.

    Need to translate a formula using TRIM?

    Use our translator to convert your complete formula