Skip to content
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.

  1. Strip leading, trailing, and doubled spaces from a pasted name:

    =TRIM(A2)

    Result"Maria Lopez"

  2. Fix a lookup that fails because the key has a trailing space:

    =VLOOKUP(TRIM(E2), A2:C200, 3, FALSE)

    Result24.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…