Remove extra spaces from text using TRIM in Google Sheets

Use the TRIM function to remove leading, trailing, and repeated inline spaces so lookups, sorting, and exports work reliably.

What the video covers

Apply TRIM to a column of text in a Google Sheets spreadsheet to produce a cleaned helper column and (optionally) replace the original data with the cleaned values.

Watch the video on YouTube

Step-by-step instructions

  1. Open your spreadsheet
    Open the Google Sheets file that contains the raw text column you want to clean.
  2. Insert a helper column
    Create a new column next to the raw data column (for example, insert a column to the right).
  3. Enter the TRIM formula
    In the first row of the helper column (e.g., B2 if your raw data starts in A2), enter =TRIM(A2) and press Enter. This removes leading/trailing spaces and reduces repeated internal spaces to single spaces.
  4. Fill the formula down
    Copy the formula down the helper column for all rows (double-click the fill handle, drag it down, or use copy/paste) so every value is cleaned.
  5. Use TRIM inside lookups if preferred
    To avoid creating a helper column, wrap TRIM around lookup inputs directly (for example: =VLOOKUP(TRIM(A2), D:E, 2, FALSE)).
  6. Optionally remove hidden characters
    If you suspect hidden line breaks or non-printing characters, use =TRIM(CLEAN(A2)) to remove them before trimming whitespace.
  7. Replace raw data with cleaned values (optional)
    Copy the helper column, then paste over the original column using Paste special → Values only to replace raw text with the cleaned results.

Watch the video

Video thumbnail for Remove extra spaces from text using TRIM in Google Sheets Play tutorial

Watch on YouTube

Why it matters

Extra spaces (leading, trailing, or multiple internal spaces) cause failed exact matches, incorrect sort orders, and bad exports. TRIM standardizes whitespace quickly and reliably.

Check your result

After applying TRIM, verify a few cells: there should be no leading or trailing spaces and consecutive internal spaces reduced to single spaces. Lookups and sorts should return expected results.

Troubleshooting

If hidden line breaks or non-printing characters remain, wrap TRIM around CLEAN (e.g., =TRIM(CLEAN(A2))). If formulas don't fill down, drag the fill handle or copy-paste the formula manually. If pasting values over originals still preserves spaces, ensure you pasted 'Values only'.