What is the use of TRIM function?
TRIM Function in Excel removes unwanted spaces whether they occur between words or at the beginning or end of a string, except for single spaces between words.
What is the syntax of TRIM function?
TRIM(text)
TRIM Function in Excel – Examples
In the above examples , you can observe how TRIM function is removing the unwanted spaces:
Example 1: Removing the spaces (between ANALYSIS and TABS) of the given string
Example 2: Removing the spaces (left side of the ANALYSIS TABS) of the given string
Example 3: Removing the spaces (right side of the ANALYSIS TABS) of the given string
Example 4: Removing the spaces (anywhere) of the given string
VBA example on TRIM function
TRIM function is also available in VBA, following is the example code:
Dim sOutout As String
sOutout =Trim(” Analysis Tabs “)