In this article:

Google Sheets TRIM Function (Easiest Way to Use It in 2024)

Google Sheets TRIM Function

The Google Sheets TRIM function is used to remove extra spaces from text except for single spaces between words. This means it will eliminate leading and trailing spaces, as well as any extra spaces in between the words of the text which leaves only one space between each word.

Syntax

The syntax of the TRIM function is:

TRIM(text)

text is the string or reference to a cell containing the text you want to clean up.

How to Use the TRIM Function in Google Sheets

Follow the steps below to use the TRIM function in Google Sheets. 

1. Choose the Cell for Cleaned Text Output

Click on the cell where you want to display the cleaned text, such as B1 next to your first text entry.

google sheets trim

2. Input the TRIM Function Formula

Type =TRIM( into the selected cell to start the function for cleaning text.

trim google sheets

3. Add the Reference of the Cell You Want to Clean

Specify the cell reference containing the text you want to clean. For example, input =TRIM(A1) to clean the text in cell A1.

trim function google sheets

4. Complete the Function with a Closing Parenthesis and Press Enter

Finish your formula with a ) and press Enter. Extra spaces from the reference cell should now be removed.

google sheets trim function

5. Duplicate the TRIM Function for Other Cells

Copy the TRIM function from B1 and paste it into cells B2 through B5, adjusting the cell references as necessary.

trim in google sheets

6. Verify the Cleaned Text in All Applied Cells

Review the cells with the TRIM function applied. Ensure that extra spaces are removed from the text.

We hope that you now have a better understanding of how to set up Google Sheets TRIM function. If you enjoyed this article, you might also like our article on how to clear contents in Google Sheets or our article on how to use Google Sheets offline.

Automate repetitive tasks with Lido

Save hours on repetitive and tedious work. Lido is a new spreadsheet that connects your spreadsheets, forms, PDFs, and email inbox.

Trigger
Action
Select trigger
When a cell value in Google Sheets changes
Check Google Sheets for today's date
When a new row is added to Google Sheets
On new Google Form submission
Send me a daily reminder
On new Typeform submission
When a cell value in database changes
Check database for today's date
When a new row is added in database
When a new HubSpot customer is created
Select action
ADDCALENDAREVENT
Creates a one- or multiple-day calendar event with optional attendees
ADDHUBSPOT
Adds an object to Hubspot
ADDSLACKCHANNEL
Create a Slack channel, and optionally add a topic or members
CALLURL
Makes any HTTP request
CREATEGOOGLEDOC
Replaces [@column_name] values in a Google Doc with the corresponding table row's values
CREATEPDF
Replaces [@column_name] values in a Google Doc with the corresponding table row's values, then export it as a PDF
FETCH
Makes any HTTP request and returns the response
INSERTROWS
Inserts given array below defined values in given worksheet
SENDGMAIL
Sends an email using your Google account
SENDOUTLOOK
Sends an email using your Microsoft Outlook account
SENDSLACK
Sends a Slack message
SENDSMS
Sends an SMS message using your Twilio account
UPDATECELL
Updates cells with given values
UPDATEHUBSPOT
Updates a property of a Hubspot object
Trigger is required
Action is required
Get started