The LEFT function returns the first characters from a text string, based on a number you specify. It is ideal for pulling codes, initials, or prefixes from longer text without manual editing.
=LEFT(text, [num_chars])What does LEFT do?
The LEFT function in Excel extracts a specified number of characters from the beginning of a text string. You give it the text and how many characters you want, and it returns just that leading portion. For example, =LEFT("Excel", 2) returns "Ex". It is one of the simplest text functions, but it solves many everyday data problems.
Why does it matter? Office workers and students often deal with text that contains useful information at the start: product codes, area codes, initials, or date parts. Instead of retyping or using complex formulas, LEFT lets you isolate that prefix quickly and consistently. It also works well inside other formulas, such as combining it with IF or VALUE.
Imagine a list of employee IDs like "EMP-1023" and you need only the "EMP" prefix to group records. Or a column of full names where you want the first initial. LEFT handles these tasks in seconds. This guide walks through the syntax, worked examples, common mistakes, and tips so you can use LEFT confidently.
When to use LEFT
- Extracting area codes or prefixes from phone numbers.
- Getting the first initial from a full name.
- Pulling a fixed-length product category code from a SKU.
- Isolating the year from a text date like "2024-05-01".
- Removing unwanted characters from the start of imported text.
- Creating short labels from longer descriptions.
LEFT syntax
=LEFT(text, [num_chars])| Argument | Required? | What to enter |
|---|---|---|
text | Required | The text string or cell reference from which to extract characters. Example: A2 or "Hello". |
num_chars | Optional | The number of characters to extract from the left. If omitted, it defaults to 1. Must be zero or greater. Example: 3. |
What it returns: A text string containing the specified number of characters from the start of the original text. If num_chars is greater than the text length, the entire text is returned. If num_chars is 0, an empty string is returned.
LEFT examples
1 Extract the first three characters of a product code
Column A contains product codes. The goal is to pull the first three characters, which represent the category. The formula =LEFT(A2, 3) looks at cell A2 and returns the first three characters. For "PRD-1001", it returns "PRD". Copy the formula down to apply it to other rows.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | ProductCode | |||
| 2 | PRD-1001 | PRD | ||
| 3 | PRD-1002 | |||
| 4 | SRV-2001 | |||
| 5 | SRV-2002 | |||
| 6 | ACC-3001 | |||
| 7 | ACC-3002 | |||
| 8 |
2 Get the first initial from a full name
Column A has full names. You want the first initial for a badge or short label. The formula =LEFT(A2, 1) returns just the first character of the name in A2. For "Alice Johnson", it returns "A". This works for any name length.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | FullName | |||
| 2 | Alice Johnson | A | ||
| 3 | Bob Smith | |||
| 4 | Carol White | |||
| 5 | David Brown | |||
| 6 | Eva Green | |||
| 7 |
3 Extract the area code from a phone number
Column A contains phone numbers stored as text. The area code is the first three digits. The formula =LEFT(A2, 3) returns those three characters. For "555-123-4567", it returns "555". This helps group or filter by region.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Phone | |||
| 2 | 555-123-4567 | 555 | ||
| 3 | 212-987-6543 | |||
| 4 | 415-555-0000 | |||
| 5 | 305-444-1111 | |||
| 6 |
4 Combine LEFT with IF to flag a prefix
Column A has order IDs. You want to flag orders that start with "UK" as international. The formula =IF(LEFT(A2,2)="UK","International","Domestic") checks the first two characters. If they are "UK", it returns "International"; otherwise "Domestic". For "UK-1001", it returns "International".
| A | B | C | D | |
|---|---|---|---|---|
| 1 | OrderID | |||
| 2 | UK-1001 | International | ||
| 3 | US-1002 | |||
| 4 | UK-1003 | |||
| 5 | CA-1004 | |||
| 6 |
Common LEFT errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #VALUE! | num_chars is negative or non-numeric. | Ensure num_chars is a number zero or greater. Use a positive integer or omit it. |
| #NAME? | The function name is misspelled, e.g., "LEF" instead of "LEFT". | Check the spelling: it must be LEFT. |
| Empty result | num_chars is 0 or the text is empty. | Set num_chars to at least 1, and verify the source cell contains text. |
| Unexpected characters | Leading spaces in the text are counted as characters. | Use TRIM on the source text before applying LEFT, e.g., =LEFT(TRIM(A2),3). |
Tips for using LEFT
- If num_chars is omitted, LEFT returns the first character by default.
- Use LEFT with VALUE to convert extracted numbers from text to numeric values.
- Combine LEFT with FIND or SEARCH to extract text before a delimiter.
- Remember that LEFT always returns text, even if the result looks like a number.
- To extract characters from the end of a string, use the RIGHT function instead.
- Test your formula on a few rows before filling it down to catch unexpected spaces or formats.
Frequently asked questions
What does the LEFT function do in Excel?
LEFT returns the first characters from a text string, based on the number you specify. It is useful for extracting prefixes, codes, or initials.
Can LEFT return a number instead of text?
LEFT always returns text. To get a number, wrap it with VALUE, for example =VALUE(LEFT(A2,3)).
How do I extract characters after a space using LEFT?
Use LEFT together with FIND to locate the space: =LEFT(A2, FIND(" ", A2)-1) returns everything before the first space.
What happens if num_chars is larger than the text length?
LEFT returns the entire text string without error.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. LEFT reference