30 Excel functions in 30 days: TRIM

Yesterday in the marathon 30 Excel functions in 30 days we stumbled upon a lazy brother-in-law named AREAS (AREAS). This function is not often used in practice, but with it we saw how the three reference operators work in Excel. Hope this tutorial was helpful to you.

We will devote the third day of the marathon to the study of the function TRIM (TRIM). In January, someone is trying to lose a few extra pounds, and for this purpose you can use Excel to create a calorie counter or weight loss graph in it. Unfortunately the function TRIM (TRIM) will not help you in the fight against extra pounds, but it can remove extra spaces from the text line.

So let’s take a look at the reference information and examples of using the function TRIM (TRIM) in Excel. If you have your own tricks or examples on this function, please share them in the comments. And good luck with counting calories!

Function 03: TRIM

Function TRIM (TRIM) removes all spaces from a text string except single spaces between words.

How can you use the TRIM function?

Function TRIM (TRIM) can help clean up text downloaded from a website or imported from another application. Function TRIM (TRIM):

  • Removes spaces at the beginning and end of a line.
  • Removes all spaces from text except single spaces between words.
  • Does NOT remove some special characters copied from the website.

TRIM Syntax (TRIM)

The TRIM function has the following syntax:

TRIM(text)

СЖПРОБЕЛЫ(текст)

  • text (text) is a reference to a cell or text string from which you want to remove spaces

TRIM TRAP

Function TRIM (TRIM) only removes standard space characters from text. If you are copying text from a website, it may contain non-breaking space characters, which function TRIM (TRIM) cannot be deleted.

Example 1: Remove spaces from the beginning and end of a text string

You can use the function TRIM (TRIM) to remove all leading and trailing spaces from a text string. In the figure below, cell C5 contains text with two extra spaces at the beginning and two at the end of the line. Function TRIM (TRIM) in cell C7 removes those 4 extra spaces.

=TRIM(C5)

=СЖПРОБЕЛЫ(C5)

30 Excel functions in 30 days: TRIM

Example 2: Remove all but single spaces between words

You can apply the function TRIM (TRIM) to extra spaces between words in the text. In the picture below, there are three extra spaces between words in cell C5. Function TRIM (TRIM) in cell C7 removes those spaces, plus two extra spaces at the beginning and end of the text string.

=TRIM(C5)

=СЖПРОБЕЛЫ(C5)

30 Excel functions in 30 days: TRIM

Example 3: How NOT to remove some special characters

Function TRIM (TRIM) DOES NOT remove some characters used as spaces. For example, a non-breaking space is likely to be present in text copied from a website. In the image below, cell C5 contains one non-breaking space, and it is not removed.

=TRIM(C5)

=СЖПРОБЕЛЫ(C5)

You can delete the non-breaking space character manually by using the function SUBSTITUTE (SUBSTITUTE) or macro. Later, during our marathon 30 Excel functions in 30 daysYou will learn a few more ways to clean up data in Excel.

30 Excel functions in 30 days: TRIM

Leave a Reply