Google Sheets
TRIM function in Google Sheets
Removes leading and trailing spaces in a specified string.
=TRIM(text)TRIM syntax and parameters
One argument, one required.
- textstringRequired
The string or reference to a cell containing a string to be trimmed.
TRIM examples
Formulas you'll actually reuse.
Strip leading, trailing, and doubled spaces from a pasted name:
=TRIM(A2)Result
"Maria Lopez"Fix a lookup that fails because the key has a trailing space:
=VLOOKUP(TRIM(E2), A2:C200, 3, FALSE)Result
24.99
TRIM in Excel
Same name — your formula ports as-is.
Try TRIM in the playground
Edit the example — nothing to install.
Preloaded with the TRIM formula from Example 1 — change anything and watch it respond.
Loading the editor…
Related functions
More ways Google Sheets gets this done.
- ARABICComputes the value of a Roman numeral.TextExcel
- CHARConvert a number into a character according to the current Unicode table.TextExcel
- CLEANReturns the text with the non-printable ASCII characters removed.TextExcel
- CODEReturns the numeric Unicode map value of the first character in the string provided.TextExcel
- CONCATENATEAppends strings to one another.TextExcel
- DOLLARFormats a number into the locale-specific currency format.TextExcel