EXCEL SOLUTIONS

TRIM function in Excel

Removes extra spaces from text: leading and trailing spaces, and doubled spaces between words.

BeginnerText

Syntax

=TRIM(text)
Arguments of TRIM
ArgumentWhat it means
textThe text or cell to clean.

Examples with results

Every result below is calculated by the practice engine on the sample data shown, not typed in by hand.

Contact list pasted from an email (fictional)

RowAB
1Raw nameEmail
2 amira HASSAN Amira.Hassan@Example.com
3ben CARTERben.carter@example.com
4CHEN weiCHEN.WEI@EXAMPLE.COM
5dina alidina.ali@example.com
Contact list pasted from an email (fictional) Row 1 holds the headings. All data is fictional. Dates are year-month-day.

Download CSV

  • =TRIM(A2)amira HASSAN

    Remove the extra spaces from a name

  • =TRIM(B3)ben.carter@example.com

    Remove a trailing space from an email

Try it yourself

Change the formula or switch to other sample data.

Press Calculate to see the result.

The practice box runs in your browser with BDK’s own calculator, which covers about 60 common functions. Cell references work as in Excel (B2, B2:B9). Your formulas are not saved or sent anywhere. For anything unusual, check the result in Excel itself.

How people use TRIM at work

  • Administration

    Clean imported names before you look them up.

    =TRIM(A3)ben CARTER
    Data: Contact list pasted from an email (fictional)
  • General office

    Make text match before using VLOOKUP.

    =TRIM(B4)CHEN.WEI@EXAMPLE.COM
    Data: Contact list pasted from an email (fictional)

Common mistakes and tips

  • TRIM does not remove non-breaking spaces copied from web pages. Use SUBSTITUTE(A1,CHAR(160)," ") first.
  • TRIM gives a text result. Copy and paste it as values if you want to replace the original column.

Works in

All versions of Excel, and Google Sheets.

Related formulas

PROPERSUBSTITUTELEN

Lessons that use it

Tools that help

Need Something Different? Let’s Talk.

Looking for different features or something built around your workflow? Share your idea with us.