Google Sheets | TRIM | Remove Whitespace | Alternative to TRIM | Example | Spreadsheet | Tutorial

Опубликовано: 16 Август 2024
на канале: Software Spring
87
7

Use the Google Sheets TRIM function or TRIM whitespace feature to
remove any leading or trailing whitespaces or extra spaces between words. By removing whitespaces, data will be clean, and, more importantly, the output of functions like the LEN function (which returns the length of a text string), will be accurate.

Let's consider an example that illustrates the need to remove any extra
whitespaces in data: Consider the text inventory. The LEN function, with
the said text as its argument, will return 9, assuming there are no whitespaces. If, however, say there is a leading whitespace, then LEN will count the whitespace also and will return 10.

***************************************
How to Use TRIM in Google Sheets?

TRIM removes leading and trailing whitespace and extra spaces between words:

   • Google Sheets TRIM Function | Remove ...  
***************************************

-------------------------------------
How to Create a Pivot Table in Google Sheets?

Create a pivot table for calculation and in-depth data analysis:

   • Google Sheets | Pivot Table | How to ...  
-------------------------------------
How to Use Convert to Table in Google Sheets?

Convert a data range into a table easily:

   • Google Sheets | Convert to Table | Ch...  
-------------------------------------
How to Use REDUCE in Google Sheets?

Use REDUCE to get the final value of intermediate calculations:

   • Google Sheets | REDUCE | Function | R...  
-------------------------------------
How to Use SCAN in Google Sheets?

It's easy to calculate running total, running count and the like with SCAN:

   • Google Sheets | SCAN | Function | Cal...  
-------------------------------------
How to Use QUERY in Google Sheets?

QUERY helps, among others, to extract specific or all data from a range:

   • Google Sheets | QUERY | Function | Ex...  
-------------------------------------
How to Use FREQUENCY in Google Sheets?

FREQUENCY returns the frequency distribution of data:

   • Google Sheets | FREQUENCY | Function ...  
-------------------------------------
How to Use COUNTIFS in Google Sheets?

Count values that fulfill one or more criteria:

   • How to use COUNTIFS in Google Sheets ...  
-------------------------------------
How to Use XLOOKUP to Extract Multiple Values in Google Sheets?

XLOOKUP can return a single row or column with the search key:

   • Google Sheets | XLOOKUP | Function | ...  
-------------------------------------
How to Use VLOOKUP in Google Sheets?

Use VLOOKUP to get a single value:

   • VLOOKUP Google Sheets | How to Use VL...  
-------------------------------------

How to Remove Whitespaces using TRIM Function?

TRIM function removes leading and trailing whitespaces and extra spaces
between words.

Syntax of TRIM Function Formula:

Example of TRIM Function Formula:

=TRIM(A2)

The above formula removes any whitespaces or extra spaces in the string in cell A2.

TRIM is not an array function. To specify an array as the argument of TRIM,
nest it inside ARRAYFORMULA:

=ARRAYFORMULA(TRIM(A2:A6))

How to Remove Whitespaces without using TRIM Function?

Select the range of cells to remove any whitespaces.

Click Data.

Move the cursor over Data cleanup and select trim whitespace.

Google Sheets removes any whitespaces and extra spaces.

Take a look at this video tutorial, which gives the steps to trim whitspace using TRIM and without using TRIM, with examples.