MS Excel: LEFT Function (WS, VBA)
Learn how to use the Excel LEFT function with syntax and examples.
The Microsoft Excel LEFT function allows you to extract a substring from a string, starting from the left-most character.
The syntax for the Microsoft Excel LEFT function is:
LEFT( text, [number_of_characters] )
Parameters or Arguments
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.
The LEFT function can be used in the following versions of Microsoft Excel:
- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Excel Function
The LEFT function can be used in Microsoft Excel as the following type of function:
- Worksheet function (WS)
- VBA function (VBA)
Example (as Worksheet Function)
Let's look at some Excel LEFT function examples and explore how you would use the LEFT function as a worksheet function in Microsoft Excel:
Based on the spreadsheet above, the following Excel LEFT examples would return:
||would return "Alpha"
||would return "techonth"
||would return "Ex"
||would return "E"
||would return "Excel"
Example (as VBA Function)
The LEFT function can also be used in VBA code in Microsoft Excel.
Let's look at some Excel LEFT function examples and explore how you would use the LEFT function in Excel VBA code:
Dim LResult As String
LResult = Left("Alphabet",3)
The variable LResult would now contain the value of "Alp".