How to use the TRIM function
The picture above shows you values that have multiple leading and trailing blanks, sometimes also between words.
The TRIM function deletes all blanks or space characters except single blanks between words in a cell value.
Excel Function Syntax
TRIM(text)
Argument
text | The string or cell value you want to delete blanks from. |
Comments
The TRIM function removes the space character from a cell value, however, there is another space character commonly used in HTML pages that are not removed by this function.
To remove that space character you need to use the SUBSTITUTE function with the TRIM function. Formula in cell C3:
CHAR(160) returns the other space character that TRIM can't delete. The SUBSTITUTE function then replaces the HTML space character with a regular space character.
Articles with the 'TRIM' Function
The following 3 articles have formulas that contain the TRIM function.
Text to columns: Split words in a cell
This blog article describes how to split strings in a cell with space as a delimiting character, like Text to […]
The formula demonstrated above in cell range C3:C9 extracts the last word from adjacent cell in column B. =TRIM(RIGHT(SUBSTITUTE(B3, " […]
Extract k-th word in cell value
The formula displayed above in cell range D3:D9 extracts a word based its position in a cell value. For example, […]
Functions in 'Text'
The TRIM function function is one of many functions in the 'Text' category.
The ASC function converts full-width (double-byte) characters to half-width (single-byte) characters. This function is for double-byte character set (DBCS) languages. […]
Use CHAR function to convert a number to the corresponding character. This is determined by your computers character set. Windows ANSI […]
The CLEAN function deletes nonprintable characters in a value, more specifically, it is designed to delete the first 32 nonprinting […]
The CODE function returns a specific number for the first character of the text argument, determined by your computers character set. […]
How to use the CONCAT function
The CONCAT function concatenates values from multiple cells. There is, however, no delimiting character or a way to ignore empty […]
How to use the CONCATENATE function
The CONCATENATE function lets you add text strings into one single text string. The function has been replaced by the […]
The EXACT function allows you to check if two values are precisely the same, it returns TRUE or FALSE. The […]
The FIND function returns the position of a specific string in another string, reading left to right. Note, the FIND function […]
The FIXED function rounds a number to the specified number of decimals, formats the number in decimal format using a […]
The LEFT function extracts a specific number of characters always starting from the left. Excel Function Syntax LEFT(text, [num_chars]) Arguments […]
The LEN function returns the number of characters in a cell value. Formula in cell D3: =LEN(B3) Cell B7 contains […]
The LOWER function converts a value to lower case letters. Formula in cell C3: =LOWER(B3) Excel Function Syntax LOWER(text) Arguments […]
The MID function returns a substring from a string based on the starting position and the number of characters you want […]
The REPT function repeats a specific text a chosen number of times. Formula in cell D3: =REPT(B3,C3) Excel Function Syntax […]
The RIGHT function extracts a specific number of characters always starting from the right. Excel Function Syntax RIGHT(text,[num_chars]) Arguments text […]
How to use the SEARCH function
Returns a number representing the position a substring is, if found in a textstring. FIND is case sensitive and SEARCH is not.
How to use the SUBSTITUTE function
The SUBSTITUTE function replaces a specific text string in a value. Case sensitive. Formula in cell E3: =SUBSTITUTE(B3,C3,D3) Excel Function […]
The T function returns a text value if the argument is a text value. Formula in cell C3: =T(B3) The […]
Excel function syntax TEXT(value, format_text) Converts a value to text in a specific number format. Arguments value - The string […]
How to use the TEXTJOIN function
The TEXTJOIN function is a new function for office 365 subscribers, it is like the CONCATENATE function on steroids or what the CONCATENATE function […]
The picture above shows you values that have multiple leading and trailing blanks, sometimes also between words. The TRIM function […]
How to use the UNICHAR function
Use the UNICHAR function to calculate a character based on a number. Excel Function Syntax UNICHAR(number) Arguments number Required. The […]
How to use the UNICODE function
Use the UNICODE function to return a Unicode number based on a character. Excel Function Syntax UNICHAR(text) Arguments text Required. […]
Converts a value to upper case letters. Formula in cell C3: =UPPER(B3) Excel Function Syntax UPPER(text) Arguments text Value to convert. Required. Excel […]
Converts a text string that represents a number to a number. This function is included for compatibility with other software. […]
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form