TRIM
The TRIM formula removes any leading and trailing whitespace from text in a cell. This can be useful when importing data or when dealing with data that includes extra spaces. The TRIM function is commonly used in data cleaning and formatting.- How to use
TRIM
formula? - Examples of using
TRIM
formula TRIM
formula not working?- Similar formulas to
TRIM
Usage
Use the TRIM
formula with the syntax shown below, it has 1 required parameter:
- text (required):
The text or reference to a cell containing text that you want to trim. Text can be up to 50,000 characters.
Examples
Here are a few example use cases that explain how to use theTRIM
formula in Google Sheets.
Removing extra spaces
Sometimes when importing data or copying and pasting from other sources, extra spaces can be added to text. TRIM can be used to quickly remove these extra spaces and clean up the data.
Formatting names
TRIM can be used to remove any extra spaces before or after names in a list, ensuring that the names are consistently formatted.
Cleaning up data
When working with large data sets, there can be inconsistencies in how data is formatted. TRIM can be used to clean up inconsistent formatting and make the data easier to work with.
Common Mistakes
TRIM
not working? Here are some common mistakes people make when using the TRIM
Google Sheets Formula:
Not using quotes around the text parameter
One common mistake when using the TRIM
formula is to forget to enclose the text parameter in quotes. If this is not done, the formula will return an error.
Using the formula on a range of cells
The TRIM
formula can only be used on a single text string at a time. If it is used on a range of cells, an error will be returned.
Related Formulas
The following functions are similar to TRIM
or are often used with it in a formula:
-
CLEAN
The
CLEAN
formula is used to remove all non-printable characters from a given text string. This is useful when dealing with imported or copied data that contains hidden characters that can cause issues with further processing. -
LOWER
The
LOWER
formula converts all letters in a specified text string to lowercase. It takes one required parameter, which is the text string to be converted. This formula is commonly used to standardize text data for easier analysis and comparison. -
UPPER
The
UPPER
formula in Google Sheets converts all the letters in a given text string to uppercase. It takes one required argument, thetext
to convert. This formula is commonly used to standardize text data or to make it easier to compare text values.
Learn More
You can learn more about the TRIM
Google Sheets function on Google Support.