๐ Excel Basics #25 โ Text Functions: LEFT(), RIGHT() & MID()
Text functions are extremely useful when working with names, IDs, codes, email addresses, and other text-based data.
Three important functions to learn are:
๐ LEFT()
๐ RIGHT()
๐ MID()
๐ 1. LEFT() Function
LEFT() extracts a specified number of characters from the beginning (left side) of a text string.
Syntax:
=LEFT(text, [num_chars])
Example:
=LEFT("EXCEL2026",5)
Result: EXCEL
Another example:
If A2 = "EMP-10245"
=LEFT(A2,3)
Result: EMP
๐ 2. RIGHT() Function
RIGHT() extracts a specified number of characters from the end (right side) of a text string.
Syntax:
=RIGHT(text, [num_chars])
Example:
=RIGHT("EXCEL2026",4)
Result: 2026
If: A2 = "EMP-10245"
=RIGHT(A2,5)
Result: 10245
๐ 3. MID() Function
MID() extracts characters from the middle of a text string, starting at a specified position.
Syntax:
=MID(text, start_num, num_chars)
Example:
=MID("EMP-10245",5,5)
Result: 10245
Here:
โข 5 โ Starting position
โข 5 โ Number of characters to extract
๐ Real-World Example
Suppose you have Employee IDs:
Employee ID
EMP-10245
EMP-10321
EMP-10456
Extract the prefix:
=LEFT(A2,3)
Result: EMP
Extract the employee number:
=RIGHT(A2,5)
Result: 10245
๐ Another Example โ Product Codes
Suppose: A2 = "IND-LAP-2026"
Country code:
=LEFT(A2,3)
Result: IND
Product code:
=MID(A2,5,3)
Result: LAP
Year:
=RIGHT(A2,4)
Result: 2026
๐ Common Mistakes
โ Using the wrong character position in MID()
โ Forgetting that spaces count as characters
โ Extracting a fixed number of characters when the text length varies
๐ Real-World Uses
โข Extract employee IDs
โข Separate product codes
โข Extract country or department codes
โข Clean customer data
โข Process invoice numbers
โข Prepare data for analysis
โ
Quick Tip
LEFT() โ Extract from the left โฌ
๏ธ
RIGHT() โ Extract from the right โก๏ธ
MID() โ Extract from the middle ๐ฏ
These functions are especially useful when cleaning and transforming raw data before analysis.
Double Tap โค๏ธ For More
Post #2251
3.06K
- โค 9