Introduction
Advanced text formulas become useful when Excel data is not stored in a simple, clean format. In real projects, you may need to extract information from product codes, clean customer records, create dynamic IDs, split text, combine multiple values, or handle different text patterns. This chapter combines multiple Excel text functions into practical problems so you can test your ability to build formulas instead of using only one function at a time. Advanced Text Formula Excel Practice questions with solutions to help you understand the concepts.
Question 1: Extract Username and Domain from Email
Problem Statement
You have a list of email addresses. Extract both the username and the domain into separate columns.
Excel Data
| Username | Domain | |
|---|---|---|
| rahul.sharma@gmail.com | ||
| priya.verma@yahoo.com | ||
| amit.kumar@outlook.com | ||
| neha.kapoor@company.com | ||
| arjun.singh@gmail.com |
Solution
In B2, enter:
=TEXTBEFORE(A2,"@")
In C2, enter:
=TEXTAFTER(A2,"@")
Copy both formulas down.
Expected Output
| Username | Domain | |
|---|---|---|
| rahul.sharma@gmail.com | rahul.sharma | gmail.com |
| priya.verma@yahoo.com | priya.verma | yahoo.com |
| amit.kumar@outlook.com | amit.kumar | outlook.com |
| neha.kapoor@company.com | neha.kapoor | company.com |
| arjun.singh@gmail.com | arjun.singh | gmail.com |
Question 2: Create a Standardized Employee ID
Problem Statement
Create an employee ID using:
- First letter of employee name
- Department code
- Employee number with three digits
Required format:
R-IT-001
Excel Data
| Employee | Department | Employee No. | Employee ID |
|---|---|---|---|
| Rahul Sharma | IT | 1 | |
| Priya Verma | HR | 25 | |
| Amit Kumar | Sales | 105 | |
| Neha Kapoor | Finance | 8 | |
| Arjun Singh | IT | 42 |
Solution
In D2, enter:
=UPPER(LEFT(TRIM(A2),1))&"-"&UPPER(LEFT(TRIM(B2),2))&"-"&TEXT(C2,"000")
Copy down.
Expected Output
| Employee | Department | Employee No. | Employee ID |
|---|---|---|---|
| Rahul Sharma | IT | 1 | R-IT-001 |
| Priya Verma | HR | 25 | P-HR-025 |
| Amit Kumar | Sales | 105 | A-SA-105 |
| Neha Kapoor | Finance | 8 | N-FI-008 |
| Arjun Singh | IT | 42 | A-IT-042 |
This combines cleaning, extraction, capitalization, and number formatting.
Question 3: Extract Product Details from a Structured Code
Problem Statement
Product codes follow this format:
ELEC-LAP-2026-101
Extract:
- Category
- Product type
- Year
- Product number
Excel Data
| Product Code | Category | Product | Year | Number |
|---|---|---|---|---|
| ELEC-LAP-2026-101 | ||||
| COMP-KEY-2026-102 | ||||
| HOME-CHA-2025-103 | ||||
| ELEC-MON-2026-104 | ||||
| COMP-MOU-2025-105 |
Solution
In B2, enter:
=TEXTBEFORE(A2,"-")
In C2, enter:
=TEXTBEFORE(TEXTAFTER(A2,"-"),"-")
In D2, enter:
=TEXTBEFORE(TEXTAFTER(A2,"-",2),"-")
In E2, enter:
=TEXTAFTER(A2,"-",3)
Copy the formulas down.
Expected Output
| Product Code | Category | Product | Year | Number |
|---|---|---|---|---|
| ELEC-LAP-2026-101 | ELEC | LAP | 2026 | 101 |
| COMP-KEY-2026-102 | COMP | KEY | 2026 | 102 |
| HOME-CHA-2025-103 | HOME | CHA | 2025 | 103 |
| ELEC-MON-2026-104 | ELEC | MON | 2026 | 104 |
| COMP-MOU-2025-105 | COMP | MOU | 2025 | 105 |
Question 4: Clean and Standardize Customer Names
Problem Statement
Customer names contain extra spaces and inconsistent capitalization. Clean them and convert them to proper case.
Excel Data
| Raw Name | Clean Name |
|---|---|
RAHUL SHARMA | |
priya VERMA | |
AMIT KUMAR | |
NEHA kapoor | |
arjun SINGH |
Solution
In B2, enter:
=PROPER(TRIM(CLEAN(A2)))
Copy down.
Expected Output
| Raw Name | Clean Name |
|---|---|
RAHUL SHARMA | Rahul Sharma |
priya VERMA | Priya Verma |
AMIT KUMAR | Amit Kumar |
NEHA kapoor | Neha Kapoor |
arjun SINGH | Arjun Singh |
Question 5: Extract the Initials from a Full Name
Problem Statement
Create initials from each employee’s first and last name.
For example:
Rahul Sharma → RS
Excel Data
| Full Name | Initials |
|---|---|
| Rahul Sharma | |
| Priya Verma | |
| Amit Kumar | |
| Neha Kapoor | |
| Arjun Singh |
Solution
In B2, enter:
=UPPER(LEFT(A2,1)&TEXTAFTER(A2," ",-1,1))
For this task, a simpler and more reliable formula is:
=UPPER(LEFT(A2,1)&LEFT(TEXTAFTER(A2," "),1))
Copy down.
Expected Output
| Full Name | Initials |
|---|---|
| Rahul Sharma | RS |
| Priya Verma | PV |
| Amit Kumar | AK |
| Neha Kapoor | NK |
| Arjun Singh | AS |
Question 6: Replace Multiple Unwanted Characters
Problem Statement
Phone numbers have been imported with different separators:
-.- spaces
/
Create a clean phone number containing digits only.
Excel Data
| Raw Phone | Clean Phone |
|---|---|
| 987-654-3210 | |
| 987.654.3211 | |
| 987 654 3212 | |
| 987/654/3213 | |
| 987-654 3214 |
Solution
In B2, enter:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"-",""),".","")," ",""),"/","")
Copy down.
Expected Output
| Raw Phone | Clean Phone |
|---|---|
| 987-654-3210 | 9876543210 |
| 987.654.3211 | 9876543211 |
| 987 654 3212 | 9876543212 |
| 987/654/3213 | 9876543213 |
| 987-654 3214 | 9876543214 |
Question 7: Create a Customer Summary from Multiple Columns
Problem Statement
Create one readable customer summary containing:
- Customer name
- City
- Membership
Skip any blank values.
Excel Data
| Name | City | Membership | Customer Summary | |
|---|---|---|---|---|
| Rahul Sharma | Delhi | Premium | rahul@gmail.com | |
| Priya Verma | Noida | Regular | priya@yahoo.com | |
| Amit Kumar | Jaipur | Premium | amit@outlook.com | |
| Neha Kapoor | Pune | Regular | ||
| Arjun Singh | Mumbai | Premium | arjun@gmail.com |
Solution
In E2, enter:
=TEXTJOIN(" | ",TRUE,A2:D2)
Copy down.
Expected Output
| Name | City | Membership | Customer Summary | |
|---|---|---|---|---|
| Rahul Sharma | Delhi | Premium | rahul@gmail.com | Rahul Sharma | Delhi | Premium | rahul@gmail.com |
| Priya Verma | Noida | Regular | priya@yahoo.com | Priya Verma | Noida | Regular | priya@yahoo.com |
| Amit Kumar | Jaipur | Premium | amit@outlook.com | Amit Kumar | Jaipur | Premium | amit@outlook.com |
| Neha Kapoor | Pune | Regular | Neha Kapoor | Pune | Regular | |
| Arjun Singh | Mumbai | Premium | arjun@gmail.com | Arjun Singh | Mumbai | Premium | arjun@gmail.com |
TEXTJOIN ignores the blank email in Neha’s record.
Question 8: Extract Text Between Two Delimiters
Problem Statement
Product information is stored in this format:
Product: Laptop | Category: Electronics | City: Delhi
Extract only the category.
Excel Data
| Product Information | Category |
|---|---|
| Product: Laptop | Category: Electronics | City: Delhi | |
| Product: Mouse | Category: Computer | City: Noida | |
| Product: Chair | Category: Furniture | City: Jaipur | |
| Product: Monitor | Category: Electronics | City: Pune | |
| Product: Table | Category: Furniture | City: Delhi |
Solution
In B2, enter:
=TEXTBEFORE(TEXTAFTER(A2,"Category: "), " |")
Copy down.
Expected Output
| Product Information | Category |
|---|---|
| Product: Laptop | Category: Electronics | City: Delhi | Electronics |
| Product: Mouse | Category: Computer | City: Noida | Computer |
| Product: Chair | Category: Furniture | City: Jaipur | Furniture |
| Product: Monitor | Category: Electronics | City: Pune | Electronics |
| Product: Table | Category: Furniture | City: Delhi | Furniture |
This is a useful pattern when data contains several labeled pieces of information in one cell.
Question 9: Create a Dynamic Email Address
Problem Statement
Create a company email address using the employee’s first name and last name.
Required format:
rahul.sharma@company.com
The names may contain extra spaces or inconsistent capitalization.
Excel Data
| First Name | Last Name | Company Email |
|---|---|---|
Rahul | SHARMA | |
PRIYA | Verma | |
amit | KUMAR | |
Neha | Kapoor | |
ARJUN | Singh |
Solution
In C2, enter:
=LOWER(TRIM(A2)&"."&TRIM(B2)&"@company.com")
Copy down.
Expected Output
| First Name | Last Name | Company Email |
|---|---|---|
Rahul | SHARMA | rahul.sharma@company.com |
PRIYA | Verma | priya.verma@company.com |
amit | KUMAR | amit.kumar@company.com |
Neha | Kapoor | neha.kapoor@company.com |
ARJUN | Singh | arjun.singh@company.com |
Question 10: Complete Advanced Text Cleaning Project
Problem Statement
A company receives customer information in one column in the following format:
RAHUL SHARMA | rahul@gmail.com | DELHI | CUST-001
The data contains extra spaces and inconsistent capitalization.
Create four separate clean columns:
- Customer Name
- City
- Customer ID
Excel Data
| Raw Customer Record | Customer Name | City | Customer ID | |
|---|---|---|---|---|
RAHUL SHARMA | rahul@gmail.com | DELHI | CUST-001 | ||||
PRIYA VERMA | priya@yahoo.com | NOIDA | CUST-002 | ||||
AMIT KUMAR | amit@outlook.com | JAIPUR | CUST-003 | ||||
NEHA KAPOOR | neha@gmail.com | PUNE | CUST-004 | ||||
ARJUN SINGH | arjun@company.com | MUMBAI | CUST-005 |
Solution
Customer Name
In B2, enter:
=PROPER(TRIM(TEXTBEFORE(A2,"|")))
In C2, enter:
=LOWER(TRIM(TEXTBEFORE(TEXTAFTER(A2,"|"),"|")))
City
In D2, enter:
=PROPER(TRIM(TEXTBEFORE(TEXTAFTER(A2,"|",2),"|")))
Customer ID
In E2, enter:
=TRIM(TEXTAFTER(A2,"|",3))
Copy all formulas down.
Expected Output
| Customer Name | City | Customer ID | |
|---|---|---|---|
| Rahul Sharma | rahul@gmail.com | Delhi | CUST-001 |
| Priya Verma | priya@yahoo.com | Noida | CUST-002 |
| Amit Kumar | amit@outlook.com | Jaipur | CUST-003 |
| Neha Kapoor | neha@gmail.com | Pune | CUST-004 |
| Arjun Singh | arjun@company.com | Mumbai | CUST-005 |
This exercise combines TEXTBEFORE, TEXTAFTER, TRIM, PROPER, and LOWER into a practical data-cleaning workflow.
Key Takeaways
- Advanced text formulas usually combine two or more Excel functions.
TEXTBEFOREandTEXTAFTERare useful for extracting information around delimiters.TEXTSPLITcan split structured text into multiple cells.TRIMis useful for removing unnecessary spaces.CLEANhelps remove non-printable characters from imported data.PROPER,UPPER, andLOWERhelp standardize text.SUBSTITUTEcan remove multiple unwanted characters when nested.TEXTJOINcan combine multiple values while ignoring blank cells.TEXTis useful for creating formatted numbers and IDs.FINDandSEARCHcan help create dynamic extraction formulas.- Complex text formulas are particularly useful for cleaning imported CSV, website, CRM, and database data.
- The main skill in advanced text formulas is understanding how individual functions can work together.
FAQs
1. What are advanced text formulas in Excel?
Advanced text formulas are formulas that combine multiple text functions to solve more complex problems such as extracting, cleaning, splitting, standardizing, and rebuilding text data.
2. Why should I combine multiple Excel text functions?
One function may not be enough for real-world data. For example, you may need to extract text and then remove spaces or change capitalization.
=PROPER(TRIM(TEXTBEFORE(A2,"|")))
This single formula extracts text, removes unnecessary spaces, and formats the result.
3. What is the difference between TEXTBEFORE and TEXTAFTER?
TEXTBEFORE returns the text before a specified delimiter.
=TEXTBEFORE(A2,"@")
TEXTAFTER returns the text after the delimiter.
=TEXTAFTER(A2,"@")
4. How can I clean imported customer data?
A common approach is to combine functions such as:
TRIM
CLEAN
PROPER
LOWER
SUBSTITUTE
TEXTBEFORE
TEXTAFTER
The exact combination depends on how the source data is structured.
5. How can I remove multiple unwanted characters?
You can nest SUBSTITUTE functions.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"-",""),".","")," ","")
This can remove multiple types of unwanted separators.
6. How can I create an email address from first and last names?
For example:
=LOWER(TRIM(A2)&"."&TRIM(B2)&"@company.com")
This combines the names, removes extra spaces, and converts the result to lowercase.
7. Can TEXTJOIN ignore blank cells?
Yes. Set the second argument to TRUE.
=TEXTJOIN(", ",TRUE,A2:D2)
Blank cells in the range are skipped.
8. Can TEXTSPLIT be used to separate names?
Yes. If a full name contains spaces:
=TEXTSPLIT(A2," ")
Excel can split the name across multiple cells.
9. Why is TRIM useful with TEXTBEFORE and TEXTAFTER?
Imported data often contains spaces around delimiters. For example:
Rahul Sharma | Delhi
Using:
=TRIM(TEXTBEFORE(A2,"|"))
removes the unwanted space after the extracted text.
10. What should I learn before practicing advanced text formulas?
You should be comfortable with basic functions such as LEFT, RIGHT, MID, LEN, FIND, SEARCH, TRIM, CLEAN, SUBSTITUTE, CONCAT, and TEXTJOIN. Advanced formulas are mainly about combining these functions effectively.
Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.
