How to use the Excel TRIM function

Trim function in excel as the name suggests itself it trims some part of any string, why string because it is a text function, the function of this formula is that it removes any space in a given string but it does not remove if there is a single space is present between two words but any other unwanted spaces are removed.

Syntax: =TRIM(text)

The TRIM function syntax has the following arguments:

  • Here, ‘text’ is the text string from which you want to remove the extra spaces. This could either be entered manually (within double quotes) or can be a cell reference that contains the text string. For example, if you want to remove extra spaces from the text in cell A1, then you can use the formula =TRIM(A1)

Example: Let’s look at some Excel TRIM function examples and explore how to use the TRIM function as a worksheet function in Microsoft Excel:

Excel TRIM Function - How to use the Excel TRIM function

Syntax:  =TRIM(A2)

Result:

Excel TRIM Function 1 - How to use the Excel TRIM function

Based on the Excel spreadsheet above, the following TRIM examples would return:

Syntax: =TRIM(A3)
Result: trim function in excel

Syntax: =TRIM(A4)
Result: So Phuc.com

Syntax: =TRIM(A5)
Result: trim in excel

Syntax: =TRIM(A6)
Result: So Phuc

Syntax: =TRIM(A7)
Result: trim function excel

Syntax: =TRIM(A8)
Result: excel vba trim

Syntax: =TRIM(A9)
Result: trim excel

Note:

  • TRIM strips extra spaces from text, leaving only single spaces between words and no space characters at the start or end of the text.
  • TRIM is useful when cleaning up text that has come from other applications or environments.
  • TRIM only removes the ASCII space character (32) from text.
  • Unicode text often contains a non-breaking space character (160) that appears in web pages as an HTML entity. This will not be removed with TRIM.
  • The CLEAN function strips the first 32 non-printing characters (ASCII values 0 through 31) from text.

Add a Comment

Your email address will not be published. Required fields are marked *