LEFT function
LEFT returns a set number of characters from the start of a text string. Use it to pull fixed-length codes off the front of IDs, SKUs and account numbers, such as the state prefix in NY-2026-0142.
- Available in
- Every current version
- Category
- Text functions
- Returns
- Text: the first num_chars characters, or the whole string if it is shorter than that.
- Google Sheets
- Works the same in Google Sheets.
Syntax
=LEFT(text, [num_chars])
| Argument | Required? | What it is |
|---|---|---|
text | Required | The text or cell to read from. Numbers work too and come back as text. |
num_chars | Optional | How many characters to return. Leave it out to get just the first character. |
Examples
Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.
| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | =LEFT(A2,2) | NY | The state code: the first two characters |
| D3 | =LEFT(B3) | R | No num_chars, so just the first letter, handy for initials |
| D4 | =LEFT(A4,FIND("-",A4)-1) | TX | Everything before the first dash, whatever its length |
Try it live
This is the sample sheet. Change any number or text, or edit a formula, and the results update.
Show the sample data as a table
| Order ID | Customer | Result | |
| NY-2026-0142 | Ana Lima | NY | |
| CA-2026-0187 | Raj Patel | R | |
| TX-2025-0033 | Lee Wong | TX |
Practice LEFT
From lesson 13, LEFT, RIGHT, MID & LEN. Graded instantly, then re-checked on changed data.
City code
B2, extract the two-letter city code from the order code. Fill down to B6.Common mistakes
| What you see | Why, and how to fix it |
|---|---|
| A number comes back as text | LEFT always returns text, so =LEFT(2026,2) gives "20", which SUM ignores. Wrap it in VALUE or add 0: =VALUE(LEFT(A2,4)). |
| Dates return the wrong digits | A date is stored as a serial number such as 46088, and LEFT reads that number, not what you see. Use YEAR or TEXT(A2,"yyyy") instead. |
| Prefixes of different lengths get cut short | A fixed num_chars can't handle variable-length pieces. Find the delimiter with FIND, or use TEXTBEFORE in Excel 2024 and Microsoft 365. |
Tips
- Cut at a character by pairing LEFT with FIND: =LEFT(A2,FIND(" ",A2)-1) returns the first word.
- If num_chars is longer than the text, LEFT returns the whole text without an error.
Questions
How do I extract the first word in Excel?
Use =LEFT(A2,FIND(" ",A2)-1). FIND gives the position of the first space, and you take one fewer character. In Excel 2024 or Microsoft 365, =TEXTBEFORE(A2," ") does the same.
How do I remove the first few characters instead of keeping them?
Keep the rest with RIGHT: =RIGHT(A2,LEN(A2)-3) drops the first three characters. =REPLACE(A2,1,3,"") works too.
Lessons that use LEFT
Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.