๐ Excel Formulas Fundamentals โ Part 8
๐ Text Functions for Data Cleaning & Manipulation
In real-world datasets, text data is often inconsistent. Names may have extra spaces, different letter cases, or be combined into one field.
Text functions help you clean, extract, combine, and standardize text efficiently.
๐ These functions are heavily used by Data Analysts, Business Analysts, HR teams, and Finance professionals.
๐ง 1. LEN() โ Count Characters
LEN() returns the total number of characters in a cell, including spaces.
Syntax: =LEN(text)
Example: =LEN(A2)
If A2 contains Deepak
Result: 6
๐ Use Cases: Validate IDs, Check password length, Verify product codes
โฌ
๏ธ 2. LEFT() โ Extract Characters from the Left
Extracts a specified number of characters from the beginning of a text string.
Syntax: =LEFT(text,num_chars)
Example: =LEFT(A2,3)
If A2 = "Laptop"
Result: Lap
๐ Useful for extracting prefixes or department codes.
โก๏ธ 3. RIGHT() โ Extract Characters from the Right
Returns characters from the end of a text string.
Syntax: =RIGHT(text,num_chars)
Example: =RIGHT(A2,4)
If A2 = "INV2026"
Result: 2026
๐ Useful for extracting years, invoice numbers, or suffixes.
๐ 4. MID() โ Extract Characters from the Middle
Extracts text starting from a specified position.
Syntax: =MID(text,start_num,num_chars)
Example: =MID(A2,3,4)
If A2 = "EMP12345"
Result: P123
๐ Useful for extracting parts of employee IDs or product codes.
โ๏ธ 5. TRIM() โ Remove Extra Spaces
Removes leading, trailing, and extra spaces between words.
Syntax: =TRIM(A2)
Example:
Before: John Doe
After: John Doe
๐ Essential for cleaning imported data.
๐ 6. UPPER(), LOWER(), PROPER()
These functions standardize text case.
UPPER()
=UPPER(A2)
Result: JOHN DOE
LOWER()
=LOWER(A2)
Result: john doe
PROPER()
=PROPER(A2)
Result: John Doe
๐ Useful for customer names, addresses, and reports.
๐ 7. CONCAT() and & โ Combine Text
Using &
=A2&" "&B2
If A2 = John, B2 = Doe
Result: John Doe
Using CONCAT()
=CONCAT(A2," ",B2)
๐ Combines multiple text values into one.
๐ 8. TEXTJOIN()
Joins text with a chosen delimiter.
Syntax: =TEXTJOIN(", ",TRUE,A2:A5)
Example:
Names: Rahul, Priya, Amit
Result: Rahul, Priya, Amit
๐ Useful for generating email lists or summaries.
๐ 9. SUBSTITUTE()
Replaces specific text with new text.
Syntax: =SUBSTITUTE(text,old_text,new_text)
Example: =SUBSTITUTE(A2,"Yes","Approved")
If A2 = "Yes"
Result: Approved
๐ Great for standardizing values.
๐ ๏ธ 10. REPLACE()
Replaces text based on position.
Syntax: =REPLACE(old_text,start_num,num_chars,new_text)
Example: =REPLACE("ABC123",1,3,"XYZ")
Result: XYZ123
๐ Useful when the position of the text is fixed.
๐ 11. FIND() and SEARCH()
Both functions return the position of text inside another text string.
FIND() Case-Sensitive
=FIND("Excel",A2)
SEARCH() Case-Insensitive
=SEARCH("excel",A2)
Example: If A2 = "Learn Excel Today"
Result: 7
๐ Useful for checking whether a keyword exists in a text string.
๐ฏ Mini Practice Project
Create: Customer_Data.xlsx
Data:
First Name | Last Name | Full Name | Customer ID
john | doe | CUST-2026-001
Tasks:
โ
Convert names to Proper Case
=PROPER(A2)
โ
Create Full Name
=A2&" "&B2
โ
Remove Extra Spaces
=TRIM(C2)
โ
Extract Year from Customer ID
=MID(D2,6,4)
โ
Count Characters in Customer ID
=LEN(D2)
๐ End of Part 8
After completing this lesson, you should be able to:
โ
Extract text using LEFT(), RIGHT(), and MID()
โ
Clean data using TRIM()
โ
Standardize text with UPPER(), LOWER(), and PROPER()
โ
Combine text using CONCAT(), TEXTJOIN(), and &
โ
Replace and modify text using SUBSTITUTE() and REPLACE()
Post #2139
3.01K
- โค 9
- ๐ 1