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
-
Using
TRIM
with a single string:- Example:
=TRIM(" hello ")
- Result:
"hello"
- Example:
-
Using
TRIM
with a cell reference:- Example: If
A1
contains the value" world "
, then=TRIM(A1)
will return"world"
.
- Example: If
Use Cases and Scenarios
- Data Cleaning: Remove unnecessary leading and trailing spaces in imported data.
- Form Responses: Trim spaces from user input to ensure accurate data processing.
- 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.