When dealing with data, Microsoft Excel provides a lot of useful Text functions. We will discuss another set of Text functions; TRIM and REPT in this Article.
The TRIM formula
This function is used to remove all the leading and trailing spaces in the given text. We can pass the text directly to the function or we can pass the cell reference.
It also removes all the unnecessary spaces between the words in the given text. It will keep a single space, between the words.
The Syntax of the function is:
=TRIM(text)
where text is the given text.
| Formula | Result |
| =TRIM(” Hello, World! “) | Hello, World! |
| =TRIM(“Remove too many spaces”) | Remove too many spaces |
The REPT formula
REPT function is used to repeat the text a given number of times.
The Syntax of the function is:
=REPT(text, repeat_times)
text is the given text and repeat_times to instruct the number of times the text to repeat.
| Formula | Result |
| =REPT(“Hello! “, 2) | Hello! Hello! |
| =REPT(“Hello!”, 0) |
The value entered intorepeat_times should be a valid value. Otherwise, Excel throws the #VALUE! Error.
We discuss more topics as we go.
🙂 Sahida