MID function
a specific number of characters from a text string starting at the position you specify.
Text
Where can you use it?
Data preparation and reporting teams. Use this group to clean, split or reformat IDs, names and descriptions before using them in reports.
Scenario in the workbook
Extract a fixed-position segment. Excel counts the first character as position 1.
A worked example from the workbook
| Row | A |
|---|---|
| 6 | Invoice code |
| 7 | INV-042 |
| 8 | inv-125 |
| 9 | AB-0007 |
Trial 1
=MID(A7,5,3)Expected result042
See the inputs and instructions for all 3 examplesSyntax
MID(text, start_num, num_chars)
Copyable formulas
English Excel · en-US
=MID("INV-042",5,3)Turkish Excel · tr-TR
=PARÇAAL("INV-042";5;3)Expected result
“042”
Worked examples
Extract a fixed-position segment. Excel counts the first character as position 1.
Open the English sheet. Inputs begin at A6. F7:F9 show the live results and G7:G9 show the original results for comparison.
| Row | A |
|---|---|
| 6 | Invoice code |
| 7 | INV-042 |
| 8 | inv-125 |
| 9 | AB-0007 |
| Case | Formula | Expected result |
|---|---|---|
| Trial 1 | =MID(A7,5,3) |
042 |
| Trial 2 | =MID(A8,5,2) |
12 |
| Trial 3 | =MID(A9,4,4) |
0007 |