Syntax
=TRIM(text)
| Argument | What it means |
|---|---|
text | The 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)
| Row | A | B |
|---|---|---|
| 1 | Raw name | |
| 2 | amira HASSAN | Amira.Hassan@Example.com |
| 3 | ben CARTER | ben.carter@example.com |
| 4 | CHEN wei | CHEN.WEI@EXAMPLE.COM |
| 5 | dina ali | dina.ali@example.com |
=TRIM(A2)Remove the extra spaces from a name
=TRIM(B3)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.
Data: Contact list pasted from an email (fictional)=TRIM(A3) - General office
Make text match before using VLOOKUP.
Data: Contact list pasted from an email (fictional)=TRIM(B4)
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
Lessons that use it
Need Something Different? Let’s Talk.
Looking for different features or something built around your workflow? Share your idea with us.