How to Remove Extra and Nonbreaking Spaces in Google Sheets

Fix labels that look identical but fail to match. Compare TRIM with a formula that also handles the nonbreaking spaces often found in copied text.
Follow these steps at your own pace. Check product terms and prices directly with providers before purchasing.
Quick answer
For ordinary spaces, use
=TRIM(A2). If text copied from a website still fails to match, try=TRIM(SUBSTITUTE(A2,UNICHAR(160)," "))in a helper column. This replaces the common nonbreaking space with a regular space, then removes outside padding and collapses repeated regular spaces between words.
Reproduce an invisible mismatch
In a blank practice area, enter =" North"&UNICHAR(160)&"Dock " in A2. It creates a leading space, the words North and Dock joined by a nonbreaking space, and a trailing space. The label may look like North Dock on screen. It contains 12 characters, while the expected label has 10.
Compare three ways to check the label
| Formula | Expected result in this example | What it tells you |
|---|---|---|
=LEN(A2) | 12 | Spaces count as characters. |
=EXACT(TRIM(A2),"North Dock") | FALSE | Ordinary trimming leaves the internal nonbreaking space. |
=EXACT(B2,"North Dock") | TRUE after cleaning B2 | The spelling, case and space match the target. |
Clean the real column
In B2 enter the SUBSTITUTE-and-TRIM formula from the quick answer. Fill B down alongside the source. Test a known bad value, a value that was already correct, and a multiword label. Matching lengths alone cannot distinguish a regular space from a nonbreaking space, since both occupy one character. Use EXACT against a trusted label to check the result.
When the menu is enough
For a static column containing only ordinary spacing problems, select the affected cells in a working copy and choose Data → Data cleanup → Trim whitespace. Keep the helper-column approach for live formulas or imported labels you want to audit. Use extra care with fixed-width codes and free-form notes where repeated spaces have meaning.
If the match still fails
Check capitalization, punctuation, tabs and line breaks in a problem cell. The formula targets the ordinary space and one specific nonbreaking character. Once you verify the output, keep the helper as your comparison column or copy the cleaned labels with Paste special → Values only to a separate range. Recheck a previously missing owner when you count tasks by assignee and status, or rerun your two-column duplicate check. Google’s TRIM function notes.
Comments
Comments are reviewed before they become public.
Sign in with Google to leave a comment.
Sign in with GoogleNo approved comments yet. Be the first to start the discussion.