TRIM Words in Excel

If you just need to trim words in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =TRIM(text) — it removes leading and trailing spaces and collapses every run of internal spaces down to a single space.

Syntax

=TRIM(text)

Arguments

ArgumentDescription
textrequiredThe text or cell to clean of extra spaces.

Related functions

SUBSTITUTELEFT/RIGHT/MIDTEXTJOIN
ƒxRemove Extra SpacesLive
Converted text
25

14 characters removed · 25 characters

Non-breaking spaces from web copy-paste are normalised too — TRIM alone leaves those behind.

=TRIM(SUBSTITUTE(A2,CHAR(160)," "))
Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

TRIM tidies up text by stripping spaces from the start and end of a value and reducing any stretch of multiple spaces between words to one. It is the standard fix for data pasted from other systems, where stray spaces break lookups and sorts. The important caveat is that TRIM only removes the ordinary space character (CHAR(32)); it does NOT remove the non-breaking space CHAR(160) that often arrives when you paste from web pages or PDFs — for that you need SUBSTITUTE or CLEAN. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “trim words in excel”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a text operation that turns messy entries into clean, usable data, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

Cell A2 holds " John Smith " with a leading space, two spaces between the names, and a trailing space. =TRIM(A2) returns "John Smith" — the outer spaces are gone and the double space is collapsed to one. If A2 came from a web page and still looks untrimmed, a non-breaking space is hiding in it; clean it first with =TRIM(SUBSTITUTE(A2, CHAR(160), " ")). TRIM is the first cleanup step before lookups, sorts and matches, where invisible leading, trailing or doubled spaces silently cause mismatches and #N/A errors. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.

In Google Sheets

Google Sheets handles this almost identically to Excel. The formula syntax above is the same, and the menu lives under a slightly different label rather than a ribbon tab. Use the platform toggle at the top of the page to switch every keyboard shortcut between Windows and Mac, and expect at most cosmetic differences in naming. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. The short version of “trim words in excel”: the answer is at the top of this page, the tool proves it on your own numbers, and the sections above explain why it holds so the next variation does not stump you. Excel rewards people who reference cells instead of typing values and who keep inputs separate from formulas, because that is what makes a result you can audit months later. Build it once, deliberately, with the live tool as a check, and you convert a one-off lookup into a reusable skill — which is the whole point of learning the why and not just the what.

Common mistakes

  • Expecting TRIM to remove non-breaking spaces (CHAR(160)) from web or PDF paste — it does not; use SUBSTITUTE(A2, CHAR(160), " ") or CLEAN first.
  • Assuming TRIM strips every internal space — it keeps single spaces between words and only collapses multiples, which is usually what you want.
  • Editing the original cell in place expecting it to change — TRIM needs a separate cell, then paste the result back as values.

Frequently asked questions

Why does TRIM not remove all the spaces?

TRIM only handles the regular space, CHAR(32). Spaces from web or PDF paste are often non-breaking spaces, CHAR(160), which TRIM ignores. Clean those with =TRIM(SUBSTITUTE(A2, CHAR(160), " ")) or with CLEAN.

Does TRIM remove spaces between words?

Not the single spaces — it keeps one space between words and only collapses runs of two or more into one, along with removing leading and trailing spaces.

How do I trim spaces from a whole column?

Put =TRIM(A2) in a helper column, fill it down, then copy and Paste Special as Values back over the original column to replace the untrimmed text.