Text All versions ◉ 10 views

=TRIM()

Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing.

Applies To: Excel for Microsoft 365Excel for Microsoft 365 for MacExcel 2024Excel 2024 for MacExcel 2021Excel 2021 for MacExcel 2019Excel 2016
=TRIM(text)
Hover argument names in the table for details.
Output typeText
Popularity80 / 100
VolatileNo
Dynamic ArrayNo
📥 Download sample .xlsx — Coming soon ▦ Try in Playground Dedicated file for this function — safe & lightweight · sample data + live formulas
Share:

⬇ Download Sample Workbook

A dedicated .xlsx for =TRIM() with Persian sample data & live formulas — open in Excel and practice.

  • Sheet “Sample” — data table + formula in place
  • Sheet “Guide” — syntax, arguments & tips from this page
  • Instant & secure (token + rate limit)
📥 Download TRIM.xlsx — Coming soon ~ 8–12 KB · No macros

⇪ Share

Send this function to friends

🧠 🧠 Quiz this function

%d questions — syntax, example & errors — test yourself!

◧ Arguments

ArgumentTypeRequiredDescription
string Text Required The text from which you want spaces removed. The text must be contained in quotes.
cell Text Required The cell reference containing the text from which you want spaces removed.

▣ Examples

Example 1 =TRIM(" Sales report ")
Example 2 =TRIM(C3)
Example 3 =TRIM(CLEAN(B5))
Removes leading and trailing spaces from the text in the formula (First Quarter Earnings) =TRIM(" First Quarter Earnings ")
Result: First Quarter Earnings

✦ Tips

  • The TRIM function was designed to trim the 7-bit ASCII space character (value 32) from text. In the Unicode character set, there is an additional space character called the nonbreaking space character that has a decimal value of 160. This character is commonly used in Web pages as the HTML entity, ** **. By itself, the TRIM function does not remove this nonbreaking space character. For an example of how to trim both space characters from text, see Top ten ways to clean your data.

💬 Comments & Q&A 0 approved

🔒 Your comment will be published after review.

Share your thoughts — visible after admin approval

No comments yet — be the first!

✍️ Add comment / question

captcha
🔒 Your comment will be published after review.