Function · Text
Excel LEFT function
The Excel LEFT function returns the first characters of a text value. The area code of 512-555-0148 is 512.
Syntax =LEFT(text, [num_chars])
=LEFT("512-555-0148",3)Arguments
| Name | Required | What to pass |
|---|---|---|
| text | Required | The text, or a cell that holds it. |
| num_chars | Optional | How many characters to take from the left. The default is 1. |
Examples
Area code from a US phone number written with hyphens
=LEFT(B1,3)Result 512
| A | B | |
|---|---|---|
| 1 | Phone | 512-555-0148 |
| 2 | Area code | 512 |
LEFT takes characters from the start of a text value. In 512-555-0148 the first three characters are 512, the Austin area code. The hyphen is character 4, so it is not included. Parentheses, spaces, and hyphens all count. (512) 555-0148 does not start with 512. It starts with an opening parenthesis.
If you omit the second argument, LEFT returns one character. num_chars larger than the text returns the whole text, not an error. MID is what you want when the piece you need is not at the start.