Have you ever wanted to extract only a few characters from a cell in Excel?
For example, you may have a product code like LAP-2026-101 and want to extract only LAP, 101, or 2026.
Instead of doing this manually, you can use three Excel functions: LEFT, RIGHT, and MID.
These functions help you extract text from different positions in a cell.
- LEFT extracts text from the beginning.
- RIGHT extracts text from the end.
- MID extracts text from the middle.
Let’s see how to use these functions with simple examples.
1. LEFT Function in Excel
The LEFT function extracts characters from the beginning of a text.
LEFT Function Syntax:
=LEFT(text, [num_chars])
| Argument | Description |
| text | The cell containing the text. |
| num_chars | The number of characters you want to extract. |
Note: If you don’t enter the number of characters, Excel returns only the first character.
Example: Extract the First Three Characters
Suppose you have product codes in column A.
| Product Code |
| LAP-2026-101 |
| MOB-2026-102 |
| KEY-2026-103 |
| MON-2026-104 |
You want to extract the first three characters from each code.
Enter this formula in cell B2:
=LEFT(A2,3)
Press Enter and drag the formula down.
Result:

Here, 3 tells Excel to extract the first three characters.
2. RIGHT Function in Excel
The RIGHT function extracts characters from the end of a text.
RIGHT Function Syntax:
=RIGHT(text, [num_chars])
| Argument | Description |
| text | The cell containing the text. |
| num_chars | The number of characters you want to extract. |
Note: If you don’t enter the number of characters, Excel returns only the last character.
Example 1: Extract the Last Three Characters
Now, using the same product codes in column A, let’s extract only the last three digits from each product code.
Enter this formula in cell B2:
=RIGHT(A2,3)
Press Enter and drag the formula down.
Result:

Here, 3 tells Excel to extract the last three characters.
Example 2: Extract the Last Four Digits of a Phone Number
Suppose you have customer phone numbers in column A.
| Phone Number |
| 9876543210 |
| 9123456789 |
| 9988776655 |
You want to extract only the last four digits.
Enter this formula in cell B2:
=RIGHT(A2,4)
Result:

This is useful when you want to show only the last few digits of a phone number.
3. MID Function in Excel
The MID function extracts characters from the middle of a text.
You can choose where Excel should start and how many characters it should extract.
MID Function Syntax:
=MID(text, start_num, num_chars)
| Argument | Description |
| text | The cell containing the text. |
| start_num | The position where Excel should start extracting. |
| num_chars | The number of characters you want to extract. |
Example 1: Extract the Year from a Product Code
Now, using the same product codes in column A, let’s extract only the year from each product code.
Enter this formula in cell B2:
=MID(A2,5,4)
Press Enter and drag the formula down.
Result:

Let’s understand the formula:
- A2 is the cell containing the product code.
- 5 tells Excel to start from the fifth character.
- 4 tells Excel to extract four characters.
Excel has other useful text functions too. You can use the TEXTJOIN function in Excel to combine text from multiple cells, the TRIM function in Excel to remove extra spaces, and CONCATENATE and CONCAT functions to join text.
Difference Between LEFT, RIGHT, and MID Functions:
All three functions help you extract text, but they work in different ways.
| Function | What It Does | Example Formula | Result |
| LEFT | Extracts text from the beginning. | =LEFT(“EXCEL”,2) | EX |
| RIGHT | Extracts text from the end. | =RIGHT(“EXCEL”,2) | EL |
| MID | Extracts text from a position you choose. | =MID(“EXCEL”,2,3) | XCE |
Remember:
- Use LEFT to extract characters from the beginning.
- Use RIGHT to extract characters from the end.
- Use MID to extract characters from the middle.
Important Things to Know:
- If you don’t enter the number of characters in LEFT or RIGHT, Excel returns one character.
- If you enter 0, Excel returns an empty result.
- If you ask for more characters than the text contains, Excel returns all the available characters.
- MID starts counting from position 1.
- Spaces and special characters are also counted.
Frequently Asked Questions:
1. What is the difference between LEFT, RIGHT, and MID in Excel?
LEFT extracts characters from the beginning of a text. RIGHT extracts characters from the end. MID extracts characters from a position you choose.
2. Can I extract numbers using LEFT, RIGHT, and MID?
Yes. You can use these functions to extract numbers from text.
For example:
=RIGHT(A2,3)
This extracts the last three characters from cell A2.
The result is text. If you want to use it in calculations, you can convert it into a number using the VALUE function.
3. Can I extract the first name using the LEFT function?
Yes. If a full name has a space between the first and last names, use this formula:
=LEFT(A2,FIND(” “,A2)-1)
For example, if A2 contains Ravi Kumar, the formula returns Ravi.
4. Can I use these functions with cell references?
Yes. You can use cell references instead of typing text directly into the formula.
For example:
=LEFT(A2,3)
This extracts the first three characters from cell A2.
5. Do these functions change the original text?
No. LEFT, RIGHT, and MID do not change the original cell. They display the extracted text in the cell where you enter the formula.
Final Thoughts:
LEFT, RIGHT, and MID are simple but useful Excel functions.
Use LEFT to extract text from the beginning, RIGHT to extract text from the end, and MID to extract text from the middle.
These functions are especially useful when working with product codes, employee IDs, phone numbers, and other text data.
Related Articles:
TEXTJOIN Function in Excel: Join Text with a Delimiter
CONCATENATE and CONCAT Functions in Excel: How to Join Text
TRIM Function in Excel: Remove Extra Spaces from Text
Flash Fill in Excel: How to Use It With Simple Examples
Discover more from Excellopedia
Subscribe to get the latest posts sent to your email.
