Text

TRIM.

Removes all spaces from text except for single spaces between words.

Text

How it works.

TRIM removes leading, trailing, and duplicate spaces between words. It is widely used to sanitize raw data imported from external systems before performing VLOOKUP or comparison operations.

💡 In simple terms.

Cleans up text by removing extra leading/trailing spaces and multiple spaces in between words.

Analogy

"Think of this like sweeping up dust. It removes extra spaces between words and vacuums any spaces at the start or end."

Syntax guide.

=TRIM(text)

Parameters

textRequired

The text from which you want spaces removed.

Interactive formula builder.

Fill in the input arguments below to construct your custom formula string. Copy it directly to paste into your Excel spreadsheets.

Generated Output

Best Practices

  • Always wrap database queries or raw input cell references in TRIM if you are getting unexpected lookup failures.
  • TRIM only removes the standard space character (ASCII 32). It does not remove non-breaking spaces (ASCII 160).

Common Gotchas

  • If your lookup keys look identical but lookups fail, they likely have trailing spaces. Use TRIM to fix them.