Excel LEFT Function: Extract Text from the Left Side

Formulas & functions · Updated November 18, 2026

To extract characters from the beginning of a cell in Excel, use the LEFT function. If A2 contains the text ABC-104, the cell layout is A2 = ABC-104; enter =LEFT(A2,3) in another cell to return ABC. LEFT is useful for pulling out a known number of leading characters, such as a code prefix, area code, or the first few letters of a label.

What the LEFT function does

LEFT returns characters starting at the left edge of a text value. You tell it which value to read and, optionally, how many characters to return. If you leave out the character count, Excel returns just the first character. The returned result is text, even when the extracted characters look like a number.

The function works on text in a worksheet cell, text typed into a formula, or a value produced by another formula. It does not remove characters from the original cell: it creates a result in the cell containing the formula, leaving the source value unchanged. This makes it suitable for building helper columns that you can use for sorting, filtering, or later calculations.

For example, a product identifier might consist of a three-letter department code followed by a hyphen and a numeric item number. If every identifier uses that pattern, taking the first three characters isolates the department code. LEFT does not know what a department code is, however; it simply counts characters from the left. The formula is reliable only when the structure of the input supports the count you choose.

How to enter and use LEFT

In Excel for Microsoft 365 on Windows, select the cell where you want the extracted text, type an equals sign and the function, and refer to the source cell. Press Enter to calculate the result. You can then use the fill handle, the small square at the bottom-right corner of the selected cell, to copy the formula down a column. Excel normally adjusts relative references as the formula is filled.

With product codes in A2:A100, for instance, enter the formula in B2, then fill it down. In B2, the layout is A2 = the first product code; =LEFT(A2,3) returns the first three characters. In B3, the copied formula refers to A3, and so on. If your data is formatted as an Excel table, a formula entered in a table column can fill down automatically.

The second argument is the number of characters to return. It must be zero or a positive number. A count of zero returns an empty text result; a negative count causes a #VALUE! error. If the requested count is longer than the source text, Excel returns the entire source value rather than an error. Spaces count as characters, including spaces at the beginning or end of a cell.

Practical examples with codes and names

LEFT is especially straightforward when every source value has the same structure and the part you need always occupies the same number of positions. It can also be useful for small text transformations, such as creating initials or splitting a fixed-width identifier into separate fields.

  • Fixed prefix: With department codes in A2:A20 and each code beginning with two letters, the layout is A2 = the code; =LEFT(A2,2) returns its first two characters.
  • First initial: With a person’s first name in A2, the layout is A2 = the name; =LEFT(A2,1) returns the first character. A name beginning with a space will return that space, so clean or inspect the source if the result looks blank.
  • Area code: With a phone number stored as text in A2 in the format 212-555-0198, the layout is A2 = the phone number; =LEFT(A2,3) returns 212. This depends on the number having the expected format.

For a fixed-width identifier, the number of characters can come from another cell. With the source string in A2 and the desired character count in B2, the layout is A2 = the source and B2 = the count; =LEFT(A2,B2) uses the value in B2 to decide how much to return. Check that B2 contains a nonnegative number. If it is blank, zero, negative, or text that Excel cannot use as a count, the result may not be what you intended.

Extracting text before a delimiter

A fixed character count is not always appropriate. If the text to extract ends at a separator such as a hyphen, slash, space, or colon, combine LEFT with FIND. FIND locates the separator’s position, and subtracting one excludes the separator itself.

With an identifier in A2 such as NORTH-482, the layout is A2 = the identifier; =LEFT(A2,FIND("-",A2)-1) returns NORTH. The subtraction matters because FIND returns the position of the hyphen, not the count of characters before it. If the separator is the sixth character, subtracting one requests the five characters before it.

FIND is case-sensitive when searching for letters; for a literal hyphen, that distinction is irrelevant. SEARCH is a case-insensitive alternative when the delimiter is text whose capitalization might vary. Both functions return an error if they cannot find the requested delimiter. If some rows may not contain the separator, decide what those rows should show instead of letting an error pass unnoticed.

For example, with values in A2:A100 where a hyphen may be absent and you want the whole value in that case, the layout is A2 = the value to inspect; =IFERROR(LEFT(A2,FIND("-",A2)-1),A2) returns the part before the first hyphen when one exists, or the original value if it does not. IFERROR also catches errors other than a missing hyphen, so use it thoughtfully if other problems should remain visible.

Text, numbers, dates, and leading zeros

LEFT is a text function, but it can read a numeric cell by converting its value to text for the operation. This does not mean it can recover formatting that is not part of the stored value. If a cell contains the number 123 and is displayed with a custom format that makes it look like 00123, the underlying value is still 123. Extracting characters from that number will not reliably preserve the displayed leading zeros.

Identifiers such as postal codes, account numbers, and product codes are often better stored as text when leading zeros are meaningful. If Excel has already converted an entry such as 00123 into the number 123, the zeros have been lost from the stored value. You can restore them only if you know the required width or have another reliable source for the missing information. Setting a cell to Text before entering or importing such identifiers can help preserve their characters.

Dates are stored as serial numbers in Excel, even when the cells are displayed in a date format. LEFT applied directly to a date may therefore use the underlying numeric value rather than the familiar display such as 2026-11-02. If you need characters from the displayed date, first convert it to text using TEXT with a format that suits your task. Be aware that text conversion produces text, not a date value for date arithmetic.

Common problems and ways to check them

  • The result is shorter than expected: Check the count argument and inspect the source for spaces or punctuation. The count includes every character, not just letters and digits.
  • You see #VALUE!: A negative character count is a common cause. When LEFT is combined with FIND, also check whether the delimiter exists in that row.
  • The formula returns one character: If the count argument is omitted, LEFT returns one character by default. Add an explicit count if you need more.
  • Leading zeros disappear: Confirm whether the source is stored as text or as a number. A display format may show zeros that are not part of the stored value.
  • A copied formula reads the wrong cell: Relative references change when copied. If the source or count must stay fixed, use an absolute reference such as $A$2 or $B$2 where appropriate.

When a result looks wrong, compare the extracted text with the source and check the cell’s actual contents in the formula bar. A cell can appear to contain a neat code while also holding an unnoticed leading space or a different separator. TRIM can remove ordinary extra spaces in many cases, but it does not remove every possible invisible character; imported data may need further cleanup.

LEFT compared with MID, RIGHT, and TEXTBEFORE

LEFT is the right choice when the characters you need begin at the start of the text. RIGHT extracts characters from the end, while MID extracts a specified number of characters beginning at a position you choose. For a code like AB-1234, LEFT can get the prefix, RIGHT can get the last four characters, and MID can target a section in the middle if its position and length are known.

If your real goal is to split text at a delimiter rather than count characters, TEXTBEFORE can be easier to read. With AB-1234 in A2, the layout is A2 = the code; =TEXTBEFORE(A2,"-") returns AB. TEXTBEFORE is available in Microsoft 365 and Excel 2024; it is not available in every older Excel release. For compatibility with older versions, LEFT combined with FIND is a common option.

Choosing a method depends on the data. A fixed-length code is a good fit for LEFT with a count. A variable-length prefix that ends at a consistent delimiter is better handled by a delimiter-based formula. For values with multiple separators or irregular structure, a dedicated text-splitting tool or a cleanup step may be clearer than nesting increasingly complex formulas.

Frequently Asked Questions

How do I extract the first character in Excel?
With the text in A2, the layout is A2 = the source text; =LEFT(A2,1) returns its first character. If A2 begins with a space, the result is a space rather than the first visible letter.

What happens if I leave out the number of characters?
LEFT returns one character when the count is omitted. Specify a count explicitly when you need more than the first character or want the formula’s intent to be clear.

Can LEFT extract text before a space or hyphen?
Yes. With the text in A2, the layout is A2 = the value and the separator is a hyphen; =LEFT(A2,FIND("-",A2)-1) returns the text before the first hyphen. Replace the hyphen with the separator you need, and handle rows without that separator if they are possible.

Why does LEFT return text instead of a number?
LEFT returns characters, so a result made of digits is still text. If you need to do arithmetic with the result, convert it to a number only after confirming that it contains numeric characters and that losing leading zeros is acceptable.

Does LEFT work in Excel for Mac or Excel for the web?
Yes. LEFT is a standard Excel function available in Microsoft 365 for Windows, Mac, and the web. The formula syntax is the same; ribbon and keyboard details can differ between platforms, but they are not needed to enter the function in a cell.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.