Arrow left
Back to guides
Google Sheets Formulas

How to Trim Whitespaces in Google Sheets

In this article, you will learn how to remove extra spaces with the TRIM functionin Google Sheets. The function is beneficial when you need to clean up a data set as a preparation to use other functions such as COUNTIF or SUMIF.

How to use the TRIM formula in Google Sheets

  • Type “=TRIM(” or go to “Insert” “Function”“Text”“TRIM”.

  • Select a text from which you remove extra whitespaces

How to insert the TRIM function from the menu bar in Google Sheets

The generic syntax is as follows:


Text: You can refer to a cell containing a text you want to trim or type in the text directly.

The TRIM function can delete whitespaces in front of or at the end of a text string. It also removes the extra spaces between words to leave a single space.

Why spend hours creating spreadsheets, when we have already done the work for you?
100+ financial spreadsheet templates, all free and ready for you now.
Free Spreadsheet Templates

Assume you are a marketing manager and looking at customer survey data. As each form was filled by an individual customer, you see typos, especially extraneous spaces in the customer’s name section. So, you want to clean them up by using the TRIM function.

How to use the TRIM formula in Google Sheets with an example

Another way to trim whitespaces

If the number of texts you will clean up is small, you can do it manually. However, if the number is large, instead of using the TRIM function, you can take the following approach: go to the “Data” tab → “Data cleanup”“Trim whitespaces”.

The “Trim whitespaces” effect is the same as the TRIM function; it removes any spaces ahead of or at the end of text strings or takes extra whitespaces between two words to leave only single whitespace.

Turn Quickbooks Online data into a Google Sheets dashboard
100+ templates, update automatically, totally secure!
Book a Demo

Learn how to do this step-by-step in the video below 👇

Automate financial reporting with LiveFlow

Want to eliminate manual updates of your Excel & Google Sheets models?

Yes, show me how

Need help?

Our team is here to help you any time between 9am and 10pm EST.
Check Icon
Email us at:

Liked this article? Then you'll love the ones below