Excel — TRIM can't touch non-breaking spaces

Extra spaces I can't get rid of in Excel — TRIM isn't fixing them

You wrapped the column in TRIM and the extra space is still there. TRIM only removes the regular space character — it has no effect on a non-breaking space, the invisible character web pages and some exports use instead, which looks and behaves like a space but isn't one as far as TRIM is concerned. Drop your file in below to find out which kind you actually have.

clean-export · xlsx-for-ai

TRIM only knows about one kind of space

Excel's TRIM function is built to remove the standard space character — ASCII/Unicode code point 32, the one your spacebar types — from the start and end of text, and to collapse repeated internal spaces down to single ones. That's the entire scope of what it does. Any other whitespace-looking character is invisible to it.

The non-breaking space is the usual suspect

A non-breaking space (code point 160, CHAR(160) in a formula, often written   in HTML source) looks and displays exactly like a regular space but is a distinct character, historically used to keep two words from wrapping onto separate lines. Text copied from a website, a PDF, or exported from some line-of-business systems frequently carries these instead of, or mixed in with, regular spaces — and TRIM passes right over them because they don't match code point 32.

How to confirm that's what you're dealing with

A formula like =LEN(A1)-LEN(TRIM(A1)) returning a number greater than zero after TRIM has already run is the tell — TRIM cleaned the regular spaces it could see, and something else is still adding length. =CODE(RIGHT(A1,1)) on a cell with a trailing character will return 160 rather than 32 if it's a non-breaking space.

The fix: substitute before you trim

Wrap TRIM around a SUBSTITUTE that converts every non-breaking space to a regular one first, then let TRIM do its normal cleanup: =TRIM(SUBSTITUTE(A1,CHAR(160)," ")). For a one-time cleanup across a whole column rather than a formula, Find & Replace can search for the non-breaking space too — paste one copied from a source cell into the Find box, or use a formula helper column to isolate where they are. Upload your file above and the checker will point out exactly which cells still carry non-breaking spaces after a plain TRIM.

More Clean up a messy Excel export — free. guides

← All Clean up a messy Excel export — free. guides