LEFT() – Extracts leftmost characters from text

The LEFT() function returns a specified number of characters from the beginning (left side) of a text string.

Syntax

LEFT(text, numChars)

  • text: The text string or a cell reference containing the text from which to extract characters.
  • numChars: The number of characters to extract from the left of the text. This must be a non-negative integer.

Basic example

LEFT(T1A1, 3)

Extracts the first 3 characters from the text in cell T1A1.

  • If T1A1 = "Example Text": LEFT(T1A1, 7)"Example"
  • If T1A1 = "MathGrid": LEFT(T1A1, 4)"Math"
  • If T1A1 = "Data" and you request more characters than available: LEFT(T1A1, 10)"Data" (returns the entire string)
  • If T1A1 = "Information" and numChars is 0: LEFT(T1A1, 0)"" (an empty string)

Key features

  • Start-of-string extraction: Always extracts characters from the beginning of the input text.
  • Handling of numChars: If numChars is 0, it returns an empty string. If numChars is greater than the length of the text, it returns the entire text string.
  • Numeric conversion: If the text argument refers to a cell containing a number, that number will first be converted to text, and then LEFT() will operate on that text representation.

Practical uses

  • Extracting area codes from phone numbers (if formatted consistently).
  • Getting the first initial from a name: LEFT(nameCell, 1).
  • Isolating prefixes or identification codes from a longer string.
  • Creating abbreviations or shortened versions of text for display.

Common mistakes

  • numChars is negative: Providing a negative number for numChars will likely result in an error.
  • numChars is not a number: The numChars argument must be an integer or a cell reference pointing to one.
  • Text argument is a number but expecting string logic: e.g., LEFT(12345, 2) will treat "12345" as text and return "12".
  • Assuming right-to-left: LEFT() always starts from the left. For right-to-left extraction, use the RIGHT() function.

Report issue

Features, Pricing, Documentation, Support, Login

MathGrid ©

Features,
Pricing,
Documentation,
Support,
Login

MathGrid ©

Back to top Arrow