Introduction
Excel text functions are useful when you need to extract specific parts of text from a cell. LEFT extracts characters from the beginning, RIGHT extracts characters from the end, MID extracts characters from a specific position, and LEN counts the total number of characters. In this chapter, you will practice these functions with employee IDs, product codes, phone numbers, email addresses, names, invoice numbers, and other practical datasets. LEFT, RIGHT, MID and LEN Practice questions with solutions to help you understand the concepts.
Question 1: Extract the First Characters Using LEFT
Problem Statement
You have employee IDs in the format EMP-101, EMP-102, etc. Extract the first three characters from each ID.
Excel Data
| Employee | Employee ID | Prefix |
|---|---|---|
| Rahul | EMP-101 | |
| Priya | EMP-102 | |
| Amit | EMP-103 | |
| Neha | EMP-104 | |
| Arjun | EMP-105 |
Solution
In C2, enter:
=LEFT(B2,3)
Copy the formula down.
Expected Output
| Employee | Employee ID | Prefix |
|---|---|---|
| Rahul | EMP-101 | EMP |
| Priya | EMP-102 | EMP |
| Amit | EMP-103 | EMP |
| Neha | EMP-104 | EMP |
| Arjun | EMP-105 | EMP |
Question 2: Extract the Last Characters Using RIGHT
Problem Statement
A company stores product codes such as PROD-1001. Extract the last four digits from each product code.
Excel Data
| Product | Product Code | Product Number |
|---|---|---|
| Laptop | PROD-1001 | |
| Monitor | PROD-1002 | |
| Keyboard | PROD-1003 | |
| Mouse | PROD-1004 | |
| Printer | PROD-1005 |
Solution
In C2, enter:
=RIGHT(B2,4)
Copy the formula down.
Expected Output
| Product | Product Code | Product Number |
|---|---|---|
| Laptop | PROD-1001 | 1001 |
| Monitor | PROD-1002 | 1002 |
| Keyboard | PROD-1003 | 1003 |
| Mouse | PROD-1004 | 1004 |
| Printer | PROD-1005 | 1005 |
Question 3: Extract Characters from the Middle Using MID
Problem Statement
The employee IDs follow this format:
EMP-101-DEL
Extract the three-digit employee number from the middle of each ID.
Excel Data
| Employee | Employee ID | Employee Number |
|---|---|---|
| Rahul | EMP-101-DEL | |
| Priya | EMP-102-MUM | |
| Amit | EMP-103-NOI | |
| Neha | EMP-104-GUR | |
| Arjun | EMP-105-DEL |
Solution
In C2, enter:
=MID(B2,5,3)
Copy down.
Expected Output
| Employee | Employee ID | Employee Number |
|---|---|---|
| Rahul | EMP-101-DEL | 101 |
| Priya | EMP-102-MUM | 102 |
| Amit | EMP-103-NOI | 103 |
| Neha | EMP-104-GUR | 104 |
| Arjun | EMP-105-DEL | 105 |
MID starts at the position you specify and extracts the number of characters you specify.
Question 4: Find the Length of Employee Names Using LEN
Problem Statement
Calculate the number of characters in each employee’s name.
Excel Data
| Employee | Name Length |
|---|---|
| Rahul | |
| Priya Sharma | |
| Amit | |
| Neha Kapoor | |
| Arjun |
Solution
In B2, enter:
=LEN(A2)
Copy the formula down.
Expected Output
| Employee | Name Length |
|---|---|
| Rahul | 5 |
| Priya Sharma | 12 |
| Amit | 4 |
| Neha Kapoor | 11 |
| Arjun | 5 |
LEN counts spaces as characters.
Question 5: Extract the Area Code from a Phone Number
Problem Statement
Phone numbers are stored with an area code in the format:
011-45678901
Extract the first three characters as the area code.
Excel Data
| Phone Number | Area Code |
|---|---|
| 011-45678901 | |
| 022-34567890 | |
| 033-45671234 | |
| 080-22334455 | |
| 044-66778899 |
Solution
In B2, enter:
=LEFT(A2,3)
Copy down.
Expected Output
| Phone Number | Area Code |
|---|---|
| 011-45678901 | 011 |
| 022-34567890 | 022 |
| 033-45671234 | 033 |
| 080-22334455 | 080 |
| 044-66778899 | 044 |
This is especially useful when the first part of a code or number follows a fixed structure.
Question 6: Extract the Domain Extension Using RIGHT and LEN
Problem Statement
Extract the last four characters from each email address to identify common domain extensions such as .com and .org.
Excel Data
Solution
In B2, enter:
=RIGHT(A2,4)
Copy down.
Expected Output
| Extension | |
|---|---|
| rahul@example.com | .com |
| priya@example.org | .org |
| amit@company.com | .com |
| neha@school.org | .org |
| arjun@business.com | .com |
Question 7: Extract the First Name Using LEFT and FIND
Problem Statement
Names are stored as:
First Name Last Name
Extract only the first name.
Excel Data
| Full Name | First Name |
|---|---|
| Rahul Sharma | |
| Priya Verma | |
| Amit Kumar | |
| Neha Kapoor | |
| Arjun Singh |
Solution
In B2, enter:
=LEFT(A2,FIND(" ",A2)-1)
Copy down.
Expected Output
| Full Name | First Name |
|---|---|
| Rahul Sharma | Rahul |
| Priya Verma | Priya |
| Amit Kumar | Amit |
| Neha Kapoor | Neha |
| Arjun Singh | Arjun |
Here, FIND(" ",A2) locates the first space, and LEFT extracts everything before it.
Question 8: Extract the Last Name Using RIGHT, LEN and FIND
Problem Statement
Extract the last name from a full name.
Excel Data
| Full Name | Last Name |
|---|---|
| Rahul Sharma | |
| Priya Verma | |
| Amit Kumar | |
| Neha Kapoor | |
| Arjun Singh |
Solution
In B2, enter:
=RIGHT(A2,LEN(A2)-FIND(" ",A2))
Copy down.
Expected Output
| Full Name | Last Name |
|---|---|
| Rahul Sharma | Sharma |
| Priya Verma | Verma |
| Amit Kumar | Kumar |
| Neha Kapoor | Kapoor |
| Arjun Singh | Singh |
The formula uses LEN to determine the complete text length and FIND to locate the space.
Question 9: Extract Different Parts of a Product Code
Problem Statement
A product code follows this format:
ELEC-LAP-2026
Extract:
- Category →
ELEC - Product type →
LAP - Year →
2026
Excel Data
| Product Code | Category | Product Type | Year |
|---|---|---|---|
| ELEC-LAP-2026 | |||
| ELEC-MON-2026 | |||
| COMP-KEY-2026 | |||
| COMP-MOU-2026 | |||
| HOME-PRI-2026 |
Solution
Category
In B2:
=LEFT(A2,4)
Product Type
In C2:
=MID(A2,6,3)
Year
In D2:
=RIGHT(A2,4)
Copy all three formulas down.
Expected Output
| Product Code | Category | Product Type | Year |
|---|---|---|---|
| ELEC-LAP-2026 | ELEC | LAP | 2026 |
| ELEC-MON-2026 | ELEC | MON | 2026 |
| COMP-KEY-2026 | COMP | KEY | 2026 |
| COMP-MOU-2026 | COMP | MOU | 2026 |
| HOME-PRI-2026 | HOME | PRI | 2026 |
This example combines LEFT, MID, and RIGHT to break one structured code into separate columns.
Question 10: Create a Username from an Email Address
Problem Statement
Create a username by extracting everything before the @ symbol from each email address.
Excel Data
| Username | |
|---|---|
| rahul.sharma@gmail.com | |
| priya.verma@yahoo.com | |
| amit.kumar@outlook.com | |
| neha.kapoor@gmail.com | |
| arjun.singh@company.com |
Solution
In B2, enter:
=LEFT(A2,FIND("@",A2)-1)
Copy down.
Expected Output
| Username | |
|---|---|
| rahul.sharma@gmail.com | rahul.sharma |
| priya.verma@yahoo.com | priya.verma |
| amit.kumar@outlook.com | amit.kumar |
| neha.kapoor@gmail.com | neha.kapoor |
| arjun.singh@company.com | arjun.singh |
This is a practical example of combining LEFT and FIND to extract variable-length text.
Key Takeaways
LEFTextracts characters from the beginning of a text string.RIGHTextracts characters from the end of a text string.MIDextracts characters from a specific position.LENcounts the number of characters in a cell.- Spaces are counted by
LEN. LEFTandFINDcan be combined to extract text before a specific character.RIGHT,LEN, andFINDcan be combined to extract text after a specific character.MIDis useful when the required text is located in the middle of a structured value.- These functions are useful for employee IDs, product codes, email addresses, phone numbers, names, and reference numbers.
- Combining text functions makes Excel useful for cleaning and separating structured data.
FAQs
1. What does LEFT do in Excel?
LEFT extracts a specified number of characters from the beginning of a text value.
=LEFT(A2,5)
This extracts the first five characters.
2. What does RIGHT do in Excel?
RIGHT extracts characters from the end of a text value.
=RIGHT(A2,4)
This extracts the last four characters.
3. What does MID do in Excel?
MID extracts characters from a specified starting position.
=MID(A2,5,3)
This starts at character 5 and extracts 3 characters.
4. What does LEN do in Excel?
LEN counts the number of characters in a cell, including spaces.
=LEN(A2)
5. Does LEN count spaces?
Yes. Spaces are counted as characters by LEN.
6. Can LEFT and FIND be used together?
Yes. This is useful when you want to extract text before a specific character.
=LEFT(A2,FIND("@",A2)-1)
7. Can RIGHT and LEN be used together?
Yes. They can be combined with FIND to extract text after a particular character.
=RIGHT(A2,LEN(A2)-FIND(" ",A2))
8. What is the difference between LEFT and MID?
LEFT always starts extracting from the first character. MID allows you to specify where the extraction should start.
9. Can these functions be used with numbers?
Yes, but Excel treats the values as text during these text operations. If you need the extracted result to behave as a number in calculations, you may need to convert it to a number.
10. Why are LEFT, RIGHT, MID and LEN important in Excel?
They are useful for cleaning, separating, and analyzing text-based data such as IDs, codes, names, email addresses, invoice numbers, and other structured information.
Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.
