Syntax
=TRIM(text)
text- The text to clean.
TRIM removes spaces from the start and end of text and collapses runs of spaces in between down to one. Hidden extra spaces are the most common reason lookups fail on data that "looks right".
=TRIM(text)
textClean up the extra spaces in the name in A2. Answer in B2.
Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.
Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.
| A | B | C | |
|---|---|---|---|
| 1 | Raw name | SKU | Note |
| 2 | maya PATEL | ELC-0427-NY | Refund requested |
| 3 | leo rossi | FUR-1180-TX | Shipped |
| 4 | AVA KIM | OFC-0093-CA | Refund issued |
| Formula | Result | What it shows |
|---|---|---|
=TRIM(A2) | maya PATEL | Leading, trailing and double spaces removed. |
=PROPER(TRIM(A2)) | Maya Patel | Clean up a messy name completely. |
=LEN(A2) - LEN(TRIM(A2)) | 5 | How many extra spaces there were. |
Learning step by step? TRIM is covered in Lesson 23: LEN & TRIM of the free course.