Google Sheets TRIM function
Removes leading and trailing spaces and leaves a single space between words. In Spanish Sheets it is called ESPACIOS.
Syntax
English Sheets
=TRIM(text)
Spanish Sheets (Mexico locale)
=ESPACIOS(texto)
Spanish Sheets (Spain, Latin America)
=ESPACIOS(texto)
| Argument | What it is |
|---|---|
| text | The text to clean. |
Example
LEN counts the characters in a text, spaces included. TRIM removes leading and trailing spaces and leaves a single space between words. You can nest one function inside the other.
=LEN(TRIM(A2))
Common mistake
To clean a whole column at once there is also Data > Data cleanup > Trim whitespace.
About Ads
This site uses Google AdSense to display ads. These ads help us keep WebHerramientas completely free. Ads are managed by Google and meet strict security and privacy standards.
Ads help us keep WebHerramientas free for everyone
Practice TRIM
Type the formula in the sheet and check it instantly. Spanish or English function names both work. See all lessons
TRIM and LEN
LEN counts the characters in a text, spaces included. TRIM removes leading and trailing spaces and leaves a single space between words. You can nest one function inside the other.
In B2, count the characters in the text after removing the extra spaces.
| A | B | C | |
|---|---|---|---|
| 1 | Text | Characters | |
| 2 | Hello world | ||
| 3 | Sheets in English | ||
| 4 | Formulas | ||
| 5 | Pivot table | ||
| 6 | VLOOKUP | ||
| 7 |
Tip: while typing, click a cell or drag across several to insert their reference.
Frequently asked questions
- What is TRIM called in Spanish?
- In Spanish Google Sheets it is ESPACIOS. The formula =LEN(TRIM(A2)) is written =LARGO(ESPACIOS(A2)) (or with commas under a Mexico locale).
- Why does TRIM use semicolons in some spreadsheets?
- It depends on each spreadsheet's locale, under File > Settings. Where the comma is the decimal mark (Spain, much of South America), arguments are separated by semicolons. Mexico and United States locales use commas.
- What is the most common TRIM mistake?
- To clean a whole column at once there is also Data > Data cleanup > Trim whitespace.