Syntax, a live playground, a measured space-cleaning gallery, the tab and non-breaking-space traps, and a sourced error library: normalizing text spacing.
Removes extra spaces from text: strips the ends and reduces internal runs to a single space. Only the ASCII space (32) is affected.
TRIM strips leading and trailing spaces and reduces every internal run of spaces to a single space. It does not touch tabs or non-breaking spaces. Every row was measured live in HyperFormula. Click any row to load it.
| Expression | Result | Why |
|---|---|---|
| =TRIM(" Hello World ") | Hello World | Strips ends and collapses internal runs to one space |
| =TRIM(" Excel ") | Excel | Leading and trailing spaces removed |
| =TRIM("a b c") | a b c | Single internal spaces are kept |
| =TRIM(A2) | Excel | Already-clean text is unchanged |
| =TRIM(" ") | All-space input becomes an empty string | |
| =TRIM(A2&" ") | Excel | Trims spaces appended to a cell |
| =LEN(TRIM(" hi ")) | 2 | Measure length after trimming |
| =TRIM("Excel Formula") | Excel Formula | The single space between words survives |
| Expression | Result | Why |
|---|---|---|
| =TRIM("a b") | a b | A tab (CHAR 9) is NOT a space — TRIM keeps it |
| =TRIM(" a ") | a | A single leading/trailing space is removed |
Edit the table or type any formula — the engine evaluates instantly. Load a preset to see TRIM collapse runs, strip the ends, keep one internal space, and measure length after cleaning.
8 failure patterns mined from actual user reports on Reddit, Stack Overflow and Super User — each with the authentic symptom, root cause, a fix, and a runnable formula. Not textbook theory.
TRIM is available across modern Excel, Google Sheets and LibreOffice. It has been in Excel since 2003.
| Platform | Support | Notes | Gotcha |
|---|
TRIM is one piece. The full course walks the toolkit end to end with live, measured examples.