<< Go back to all functions

TRIM

The TRIM function in Google Sheets is a versatile tool to remove leading and trailing spaces in a specified string. Whether you're dealing with text data, input from forms, or data imported from external sources, the TRIM function can help clean up your data. Learn how to use this function effectively with our comprehensive guide.

Function Syntax and Parameters

Syntax: TRIM(text)

Parameters:

  • text: The string value or a reference to the cell that contains the string to be trimmed.

Step-by-Step Tutorial

  1. Using TRIM with a single string:

    • Example: =TRIM(" hello ")
    • Result: "hello"
  2. Using TRIM with a cell reference:

    • Example: If A1 contains the value " world ", then =TRIM(A1) will return "world".

Use Cases and Scenarios

  1. Data Cleaning: Remove unnecessary leading and trailing spaces in imported data.
  2. Form Responses: Trim spaces from user input to ensure accurate data processing.
  3. Text Analysis: Prepare text data for analysis by removing extra spaces.

Related Functions

  • CLEAN: Remove non-printable characters from a string.
  • SUBSTITUTE: Replace specific text within a string.

Related Articles