Need to extract a specific part of text in a cell? The MID function is your answer.
In spreadsheet tasks, you often need to extract part of a text—for example, pulling out the birthdate from a social security number or getting the middle digits from a product code. That’s where the MID function comes in handy.
🔍 What is the MID Function?
The MID function extracts a specified number of characters from a string, starting at a given position.
This function is available in both Excel and Google Sheets and is commonly used for text manipulation.
📘 Function Syntax
MID(text, start_num, num_chars)
- text: The target string or cell
- start_num: The position to start extracting from (starting at 1)
- num_chars: The number of characters to extract
✨ Example 1: Extracting a birthdate from a social security number
| Column A | Column B (Formula) | Result |
|---|---|---|
| 990101-1234567 | =MID(A2, 1, 6) | 990101 |
Extracts the first 6 digits—typically the birthdate portion.
✨ Example 2: Extracting category from a product code
| Column A | Column B (Formula) | Result |
|---|---|---|
| ABC-123-XYZ | =MID(A2, 5, 3) | 123 |
Pulls 3 characters starting from the 5th—middle category code.
✨ Example 3: Extracting fixed format text segments
| Column A | Column B (Formula) | Result |
|---|---|---|
| OrderNo:2025-KD-0001 | =MID(A2, 6, 9) | :2025-KD |
If the structure is consistent, MID can grab exactly the part you need.
✨ Example 4: Extracting part of the tail end of a string
| Column A | Column B (Formula) | Result |
|---|---|---|
| ABCDEFGHIJKLMN | =MID(A2, 10, 3) | JKL |
Grabs 3 characters from the 10th position—useful for slicing long text.
🧩 Practical Tips
- Combine
MIDwith functions likeFIND,SUBSTITUTE, orLENfor dynamic slicing. - For flexible text positions,
MIDis more powerful thanLEFTorRIGHT. - Ideal for structured data like order numbers, product codes, or formatted identifiers.
✅ Summary
| Function | Purpose |
|---|---|
MID | Extracts characters from the middle of a string |
| Best Use Cases | IDs, product codes, order numbers, etc. |






