Take the year from the middle with MID
PremiumThe year in the invoice in A2 starts at character 5 and is 4 characters long. In B2, use MID to get it.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Invoice | Year | ||||
| 2 | INV-2024-0387 | |||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 |
Premium lesson
Unlock LEFT, RIGHT and MID and every other lesson
This is a premium lesson. Premium lets you solve it and every other lesson, take the timed mock tests, and earn certificates you can share on LinkedIn.
Next with premium:FIND and SEARCHJoining text with & and TEXTJOIN
It comes up in this mock test: Excel test for admin jobs
Need help?
Why this works
MID(A2,5,4) starts at character 5 of A2 and returns 4 characters. "INV-" is characters 1 to 4, so character 5 is the "2" that starts the year.
Common mistake: Counting the start from zero. MID counts the first character as 1.
The answer
- B2
=MID(1A2,25,34)
In plain words: Take 34 characters of 1the invoice in A2, 2starting at character 5.
=MID(text, start, number_of_characters). =MID("INV-2024-0387",5,4) starts at character 5 and returns 4 characters, "2024".