Excel + Google Sheets · MID
Take text from the middle
Returns a number of characters starting at the position you choose.
The formula
=MID(A2, 5, 4)What each part means
A2The text5Start at character 54Take 4 characters
Example
| A | B | |
|---|---|---|
| 1 | Invoice | Year |
| 2 | INV-2026-0451 | |
| 3 | INV-2025-1187 | |
| 4 | INV-2026-0032 |
| A | B | |
|---|---|---|
| 1 | Invoice | Year |
| 2 | INV-2026-0451 | 2026 |
| 3 | INV-2025-1187 | 2025 |
| 4 | INV-2026-0032 | 2026 |
Step by step
- Click cell B2.
- Type the formula:
=MID(A2, 5, 4) - Press Enter.
- Drag the small square in the bottom-right corner of the cell down to copy it to the other rows.
Where it works
- Every version of Excel
- Google Sheets
- Excel for the web (free)