LEFT - Extract a prefix from text
Read branch prefixes and leading code characters without turning identifiers into numeric amounts.
By the end, you can
- Extract a fixed number of starting characters.
- Understand the default and length boundaries.
- Recognize when a varying prefix needs a delimiter-based approach.
Before you start: Read a text cell and a relative cell reference.
In this lesson
The start of an identifier can carry meaning
LEFT returns characters from the beginning of a text value. An inventory export may encode a three-letter branch at the start of each stock code. Extracting that prefix into a separate reporting column makes sorting and grouping easier. LEFT does not understand branch names; it simply follows the character count you specify.
Syntax and arguments
=LEFT(text, [num_chars])The result is text, even when the extracted characters are digits.
| Argument | Purpose | Example |
|---|---|---|
textRequired | The source cell or quoted text. | A2 |
num_charsOptional | How many characters to take; default is 1. | 3 |
Extract warehouse branch prefixes
DEL| A | B | |
|---|---|---|
| 1 | Stock code | Branch |
| 2 | DEL-1042 | DEL |
| 3 | MUM-208 | MUM |
| 4 | BLR-315 | BLR |
=LEFT(A2,3)Take D, E, and L from DEL-1042. The hyphen is the fourth character and is not included.
- Confirm that the prefix length is three in every source code.
- Enter =LEFT(A2,3) in B2.
- Fill down so each row refers to its own source cell.
- Check MUM and BLR against the original codes before grouping the report.
Default length and longer extracts
=LEFT(A2)Without num_chars, LEFT takes one character.
=LEFT(A2,7)Take the first seven characters of DEL-1042, including its separator.
=LEFT(A2,99)Excel returns the available text instead of adding padding characters.
Length, formatting, and compatibility
- Zero characters returns empty text; a negative character count produces #VALUE!.
- Spaces and punctuation occupy positions. Unwanted leading spaces can shift a supposedly fixed prefix.
- The output is text. Applying number formatting does not convert it, and digit prefixes can retain leading zeroes when the source is text.
- Classic LEFT works in older and current Excel. Unicode character counting can depend on workbook Compatibility Version; Version 2 improves surrogate-pair handling, not arbitrary grapheme grouping.
Common mistakes and Practice scope
The linked Practice task uses fixed ASCII branch codes, matching these examples. It does not test Excel's Unicode compatibility-version behavior.
Check your understanding
Choose an answer for instant feedback. You can try again; answers stay only on this page.