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.
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.
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.
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.
Are you learning this tip to visualize financial data, build a financial model, or conduct financial analysis? In that case, LiveFlow may help you automate manual workflows and update numbers in real-time. You can access various financial templates on our website, from the simple Income Statement to Multi-Currency Consolidated Financial Statement. You can also customize these templates as you want without breaking the automated data inflow.
To learn more about LiveFlow, book a demo.
Check the following articles if you are interested in formatting text in cells.
How to Make Text Bold, Italic, and Strikethrough in Google Sheets
How to Align Text in Google Sheets
How to Wrap Text in Cell in Google Sheets
How to Rotate Text in Google Sheets
How to Change Default Font in Google Sheets
How to Indent Texts in Google Sheets: Explained
How to Capitalize the First Letter in Google Sheets
How to Capitalize All Letters in Google Sheets
How to Make All Letters Lowercase in Google Sheets
TEXT Function in Google Sheets: Explained
Do you want to learn how to combine or split text in Google Sheets?
How to Combine Texts in Google Sheets
CONCAT Function in Google Sheets: Explained
How to Use the CONCATENATE function in Google Sheets
How to Split Texts into Columns in Google Sheets
How to Use SPLIT Function in Google Sheets
CHAR Function in Google Sheets: Explained
Do you want to know where a specify character or word is in a text string?
LEFT Function in Google Sheets: Explained
How to Use RIGHT Function in Google Sheets
SEARCH Function in Google Sheets: Explained
FIND Function in Google Sheets: Explained
Do you need to replace a part of text with another characters or words?
How to Use REPLACE Function in Google Sheets
SUBSTITUTE Function in Google Sheets: Explained
Do you like to show a formulae in a cell?
How to Use FORMULATEXT Function in Google Sheets
This function is useful when you need to count the number of characters in a text string.
LEN Function in Google Sheets: Explained
Why don’t you double-check the spelling of your texts or cleaning up extra spaces before printing or closing Google Sheets?
How to Spell-check in Google Sheets
You can repeat the same text string with this formula.
REPT Function in Google Sheets: Explained
You can learn about other Google Sheets formulas and tips that are not mentioned here on this page: LiveFlow‘s How to Guides
Learn how to do this step-by-step in the video below 👇