Excel Function: LEFT

Purpose

The LEFT function returns a subset of a text value’s characters, taken from its left-hand side.

Invocations of the LEFT function take the form:

LEFT(text,[num_chars])

Arguments

ArgumentArgument typeDescription
textMandatoryA text value whose leftmost characters will be returned.
num_charsOptional. Defaults to 1 if omitted.A number of characters to be returned from the left of the value passed to the text argument.

Related Functions

FunctionExamplePurpose

Error Conditions

Error valueCondition typeCondition
#VALUE!Bad argumentA negative number was supplied to the num_chars argument.
#VALUE!Bad argumentA value of type currency, geography, or stock was supplied to the text argument.

Examples

ExampleFormulaResultDescription
1=LEFT("abcdef",0)Extract zero (0) of the leftmost characters from a text value.
  • An empty text value is returned.
2=LEFT ("abcdef",4)abcdExtract fewer characters from a text value than it contains.
  • LEFT operates on “abcdef”.
  • It contains 6 characters.
  • LEFT extracts 4 characters from it.
  • The text value “abcd” is returned.
3=LEFT("abcdef",10)abcdefExtract more characters from a text value than it contains.
  • LEFT operates on “abcdef”.
  • It contains 6 characters.
  • LEFT attempts to extract 10 characters from it, but can only extract 6.
  • The text value “abcdef” is returned.
4=LEFT(123.456,4)123.Extract fewer characters from a positive number than it contains.
  • The number 123.456 is converted into the 7-character-long text value “123.456”.
  • LEFT extracts 4 characters from it.
  • The text value “123.” is returned.
5=LEFT(-123.456,4)-123Extract fewer characters from a negative number than it contains.
  • The number -123.456 is converted into the 8-character-long text value “-123.456”.
  • LEFT extracts 4 characters from it.
  • The text value “-123” is returned.
6=LEFT(1E+5,2)10Extract the leftmost characters from a number expressed in scientific notation.
  • The number 1E+5 is converted into the 6-character-long text value “100000”.
  • LEFT extracts 2 characters from it.
  • The text value “10” is returned.
7=LEFT(DATE(2023,6,7),2)45Extract the leftmost characters from a date.
  • The date 7 June 2023 is converted into the 5-character-long text value “45084”.
  • LEFT extracts 2 characters from it.
  • The text value “45” is returned.
8=LEFT(TIME(18,0,0),2)0.Extract the leftmost characters from a time.
  • The time 18:00:00 is converted into the 4-character-long text value “0.75”.
  • LEFT extracts 2 characters from it.
  • The text value “0.” is returned.
9=LEFT("abcdef",-1)#VALUE!Extract a negative number of characters from a text value.
  • Extracting a negative number of characters from a text value is nonsensical.
  • The error value #VALUE! is returned.

Examples: Errors

ExampleValue supplied to “text” argumentResultDescription
1MICROSOFT CORPORATION (XNAS:MSFT)#VALUE!Apply the LEFT function to a stock value.
  • The stock value cannot be treated as a text value by the LEFT function.
  • Because of this, the #VALUE! error value is returned.
2USD/GBP#VALUE!Apply the LEFT function to a currency value.
  • The currency value cannot be treated as a text value by the LEFT function.
  • Because of this, the #VALUE! error value is returned.
3London#VALUE!Apply the LEFT function to a geography value.
  • The geography value cannot be treated as a text value by the LEFT function.
  • Because of this, the #VALUE! error value is returned.

These errors can be mitigated by converting values of type stock, currency and geography to text before passing them to the LEFT function. I.e.:

=LEFT(VALUETOTEXT(text),[num_chars])