How to use TRIM in Google Sheets
Remove extra spaces
How TRIM works
TRIM removes spaces at the start and end of text and shrinks any run of spaces to one.
Cleans up the name in row 4.
What you’ll do
You’re now on a messy contacts table. You’ll clean the extra spaces out of a name, which is often the first step when you import data from somewhere else.
Try it
Type =TRIM(A4) into G2 and press Enter. Watch what the sheet does.
The result will appear in G2.
After you’ve run the formula, click the sheet and press Ctrl+Z Mac ⌘+Z to undo it, then Ctrl+Y Mac ⌘+Y to bring it back. (Undo.)
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Full name | SKU | Note | ||||
| 2 | maria lopez | maria.lopez@acme.com | WID-2041-BLU | Call back 555-0142 | |||
| 3 | james chen | jchen@northwind.io | GAD-1180-RED | Sent invoice | |||
| 4 | Priya Shah | priya@shahdesign.co | WID-3307-GRN | Call back 555-0199 | |||
| 5 | tom o'neil | tom.oneil@acme.com | BOX-0042-BLU | Left voicemail | |||
| 6 | Lena Park | lena.park@globex.com | GAD-2215-BLK | Call back 555-0107 | |||
| 7 | sam reed | sreed@northwind.io | WID-0918-RED | Meeting Tue |
Drill locked
Unlock the other 44 lessons for $49.99
You’ve seen how TRIM works. Pro lets you write it yourself on real data and get checked instantly, with practice sets and section reviews for every lesson.
In G2, clean up the extra spaces in the name in A2.
One payment, no subscription.