TRIM - Normalize ordinary spaces
Remove surrounding ASCII spaces and collapse repeated spaces inside names, labels, and imported contact text.
By the end, you can
- Normalize ordinary ASCII spaces with TRIM.
- Keep one intended word-separating space.
- Distinguish nonbreaking spaces and control characters.
Before you start: Understand text values and cell references. SUBSTITUTE can replace known unwanted characters.
In this lesson
Clean spacing without joining every word
Excel TRIM removes ordinary spaces at both ends and reduces runs of ordinary internal spaces to one. An HR export such as two leading spaces, Anika, three spaces, Rao, and two trailing spaces becomes Anika Rao. It does not remove every space or standardize letter case.
Syntax and argument
=TRIM(text)Supply the source string or cell. Excel's ordinary-space rule applies to ASCII character 32.
| Argument | Purpose | Example |
|---|---|---|
textRequired | Text whose ordinary spaces should be normalized. | A2 |
Messy name and contact fields
Anika Rao| A | B | |
|---|---|---|
| 1 | Imported text | Trimmed text |
| 2 | Anika Rao | Anika Rao |
| 3 | help@apex.test | help@apex.test |
| 4 | Sales Operations | Sales Operations |
=TRIM(A2)Remove the two leading/trailing spaces and reduce the three between Anika and Rao to one.
- Keep the original imported field in column A.
- Enter =TRIM(A2) in a separate output column.
Combine cleanup steps deliberately
=LOWER(TRIM(" ANIKA@APEX.TEST "))TRIM removes surrounding ordinary spaces; LOWER standardizes case. Neither validates the address.
=TRIM(A4)The words Sales and Operations remain separated by one space.
=TRIM(SUBSTITUTE(CHAR(160)&"Anika"&CHAR(160),CHAR(160)," "))Replace known nonbreaking spaces with ordinary spaces, then trim those spaces.
What TRIM does not clean in Excel
- TRIM's documented space target is ASCII 32. A web-imported nonbreaking space, character 160, is not removed by TRIM alone.
- Tabs and line breaks are different characters; CLEAN may remove ASCII control characters, while SUBSTITUTE can replace a known separator.
- TRIM changes neither case nor punctuation and does not repair spelling, duplicates, or an invalid email address.
- It is available in older and current Excel. Broadly removing whitespace can damage meaningful layout or data, so identify the unwanted characters first.
Common mistakes and workspace differences
Check your understanding
Choose an answer for instant feedback. You can try again; answers stay only on this page.