Text
MID
Definition
MID returns a set number of characters from inside a text string.
Syntax
=MID(text, start_num, num_chars)
Arguments
| Argument | Meaning |
|---|---|
text |
The text, or the cell holding it, to take characters from. |
start_num |
The first character to keep, counting from 1 at the left. |
num_chars |
How many characters to return from that start point. |
Worked example
A warehouse stores aisle codes in the form WH-4401. The codes are in A2:A4.
| A: Code |
|---|
| WH-4401 |
| WH-2280 |
| WH-9053 |
Formula: =MID(A2,4,4)
Result: 4401. Starting at character 4 of WH-4401 skips WH- and takes the four digits.
Practice
Cell A2 holds Packet. In B2, write a formula that returns 2 characters from A2 beginning at position 4.
- In B2, write a MID formula that takes 2 characters of A2 starting at position 4.
- B2 should show 2 characters of A2 starting at position 4.
Step 1 of 2
Enter =MID(A2,4,2) in B2.
A2 is Packet, so 2 characters starting at 4 are ke.
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…
B2 uses MID.
B2 now shows ke.
Related functions
MID is often paired with LEFT, which takes characters from the start, and LEN, which counts the characters so you can choose a start point.
Common mistake
Treating the first character as position 0: Excel counts from 1, so a start of 0 returns #VALUE!.