Skip to content

TRIM

TRIM strips leading, trailing, and repeated spaces, leaving single spaces between words. It is the first thing to try when VLOOKUP or MATCH returns #N/A on values that look identical.

Excel
=TRIM(A2)
Google Sheets
=TRIM(A2)

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1A2 is the text to clean.
  2. 2Leading and trailing spaces are removed.
  3. 3Multiple spaces between words collapse to one.

Need a version for your data?

Try: “Remove the extra spaces from the text in A2

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: