The LEFT, RIGHT, and MID functions are text functions used to extract specific characters from a cell. These functions are very useful when working with names, codes, ID numbers, or formatted text.
1. LEFT Function
The LEFT function extracts characters from the beginning (left side) of a text string.
Structure:
=LEFT(text, number_of_characters)
Example:
If cell A1 contains:
Karachi
Formula:
=LEFT(A1,3)
Result: Kar
It extracts the first 3 characters from the left.
2. RIGHT Function
The RIGHT function extracts characters from the end (right side) of a text string.
Structure:
=RIGHT(text, number_of_characters)
Example:
If cell A1 contains:
Karachi
Formula:
=RIGHT(A1,2)
Result: hi
It extracts the last 2 characters.
3. MID Function
The MID function extracts characters from the middle of a text string.
Structure:
=MID(text, start_position, number_of_characters)
Example:
If cell A1 contains:
Karachi
Formula:
=MID(A1,2,3)
Result: ara
Explanation:
- Start at position 2
- Extract 3 characters
Practical Example
If A1 contains:
PK-2026-001
- =LEFT(A1,2) → PK
- =MID(A1,4,4) → 2026
- =RIGHT(A1,3) → 001
These functions help extract specific parts of structured data.
Important Notes
- Spaces are counted as characters.
- These functions work only with text (numbers are treated as text if needed).
- Position counting starts from 1.
Why LEFT, RIGHT, and MID Are Important
They help you:
- Split full names
- Extract area codes
- Separate ID numbers
- Clean and organize text data
- Prepare data for reports
These text functions are essential tools for managing and analyzing text data in Excel efficiently.