LEFT Function (VBA)
In Microsoft Excel, the LEFT function allows you to extract a substring from a string, starting from the left-most character.Syntax
The syntax for the LEFT function is:LEFT( text, [number_of_characters] )
text is the string that you wish to extract from.
number_of_characters is optional. It indicates the number of characters that you wish to extract starting from the left-most character. If this parameter is omitted, only 1 character is returned.
VBA Function Example
Dim sResult As String
sResult = Left("Alphabet",3)
The variable sResult would now contain the value of "Alp".
RIGHT Function ( VBA)
In Microsoft Excel, the RIGHT function extracts a substring from a string starting from the right-most character.
Syntax
The syntax for the RIGHT function is:RIGHT( text, [number_of_characters] )
text is the string that you wish to extract from.
number_of_characters is optional. It indicates the number of characters that you wish to extract starting from the right-most character. If this parameter is omitted, only 1 character is returned.
VBA Function Example
Dim sResult As String
sResult = Right("Alphabet",3)
The variable LResult would now contain the value of "bet".
MID Function (VBA)
In Microsoft Excel, the MID function extracts a substring from a string (starting at any position).
Syntax
The syntax for the MID function is:MID( text, start_position, number_of_characters )
text is the string that you wish to extract from.
start_position indicates the position in the string that you will begin extracting from. The first position in the string is 1.
number_of_characters indicates the number of characters that you wish to extract.
VBA Function Example
Dim sResult As String
sResult = Mid("Alphabet", 5, 2)
The variable sResult would now contain the value of "ab".
No comments:
Post a Comment