Google Sheets TRIM Function

This post will guide you how to use Google Sheets TRIM function with syntax and examples.

Description


The Google Sheets TRIM function removes all spaces from text string except for single spaces between words.  You can use the TRIM function to remove extra spaces between words in a string. Or removes leading and trailing spaces from the text.

The TRIM function can be used to remove extra spaces from a given text string, it will leave only a single space between words in google sheets.  The purpose of this function is to remove extra spaces from text. and its returned value is a text with extra spaces removed.

The TRIM function is a build-in function in Google Sheets and it is categorized as a Text Function.

Syntax


The syntax of the TRIM function is as below:

= TRIM (text)

Where the TRIM function argument is:

  • Text -This is a required argument. The text string from which you want to remove the extra spaces.

Note:

  • TRIM Function only removes extra spaces in a text string, leaving just a single space between words.
  • TRIM function is very important when text is used in formulas or data validation.
  • TRIM function only removes the ASCII space character from a text string.
  • Whitespace or non-breaking space will not be trimmed. If you

Google Sheets TRIM Function Examples


The below examples will show you how to use google sheets TRIM function to remove extra spaces.

#1 To remove leading spaces in the Cell B1, Just using the following formula:

=TRIM(B1)

google sheets trim function1

#2 To remove multiple spaces between two words in B2, using the below excel formula:

=TRIM(B2)

google sheets trim function1

 

Google Sheets REPT Function

This post will guide you how to use Google Sheets REPT function with syntax and examples.

Description


The Google Sheets REPT function repeats a text string a specified number of times.

The REPT function can be used to repeat specified text repeated a number of times in google sheets. And it’s return value as the repeated text. The purpose of this function is repeat text as specified.

The REPT function is a build-in function in Google Sheets and it is categorized as a Text Function.

Syntax


The syntax of the REPT function is as below:

= REPT (text, number_times)

Where the REPT function arguments are:

  • Text -This is a required argument. The text string that you want to repeat.
  • Number_times – This is a required argument.  The number of times that you want to repeat

Note:

  • If number_times is zero, the REPT function will return empty text. And If number_times value is not an integer, it is truncated to an integer value.
  • Nuber_times argument should be zero or a positive integer, otherwise, it will return an #VALUE error.
  • REPT function takes two arguments, text and number_times. The first argument, Text is the characters to repeat. And the second argument, number_times is the number of times text should appear in the value returned.
  • REPT function does not insert any space characters between repetitions of text. If you wish to insert a space, a space character must be appended to the end of the value of text value. And the resulting return value from REPT function will have at least one trailing space, and you can use another function called TRIM function to remove it.

Google Sheets REPT Function Examples


The below examples will show you how to use google sheets REPT function to repeat a text string a given number of times.

#1 To repeat a text string in B1 cell 3 times, just using the following formula:

=REPT (B1,3) //it returns “googlegooglegoogle”

google sheets rept function

#2 Repeat “g” letter 5 times, just using the following formula:

=REPT(“g”,5) //it returns “ggggg”

google sheets rept function

#3 Repeat text string in Cell B1 using a specified number of times in Cell C1, you can type the following REPT formula in Cell D1:

=REPT(B1,C1) //it returns “googlegooglegoogle”

google sheets rept function