MID extracts characters from any position in a text string. You control where to start and how many characters to take.
MID extracts a specific number of characters from any position in a text string. Unlike LEFT (which always starts from the beginning) and RIGHT (which always starts from the end), MID lets you start anywhere. Use it to extract codes embedded in the middle of longer strings.
=MID(text, start_num, num_chars)| Argument | Description |
|---|---|
| text required | The string to extract from. |
| start_num required | The position of the first character to extract. 1 = first character. |
| num_chars required | How many characters to extract from that starting position. |
=MID(A2, 4, 3) ← "GB-LON-2026" → "LON"Start at position 4 (after "GB-"), extract 3 characters.
=MID(A2, 3, 6) ← "AB123456C" → "123456"=MID(A2, 5, 2) ← "2026-06-14" → "06"=MID(A2, FIND("@",A2)+1, LEN(A2)-FIND("@",A2))Find the @ sign, then extract everything after it.
=MID(A2, FIND("(",A2)+1, FIND(")",A2)-FIND("(",A2)-1)Extracts text between parentheses: "Revenue (GBP)" → "GBP".
When the start position varies, use FIND to locate a separator, then offset from it.
Extract between first and second hyphen:
=MID(A2, FIND("-",A2)+1, FIND("-",A2,FIND("-",A2)+1)-FIND("-",A2)-1)
"GB-LON-2026" → "LON"
MID is most powerful when your data contains structured codes where a meaningful piece of information sits at a fixed position. National Insurance numbers (AB123456C) have the numeric section starting at position 3. UK company registration numbers have type codes at specific positions. Product codes often encode category, year, and sequence at known positions.
The challenge comes when positions are variable — the middle section of "GB-LON-2026" starts at position 4, but "GBP-LONDON-2026" has it at position 5. This is where FIND becomes essential: MID(A2, FIND("-",A2)+1, FIND("-",A2,FIND("-",A2)+1)-FIND("-",A2)-1) extracts between the first and second hyphen regardless of what comes before.
MID also works with numbers — MID(TEXT(A2,"00000000"),3,4) extracts digits 3-6 from a padded number. This technique is used in financial systems where account numbers or sort codes need to be parsed from longer strings.
ExcelPro has text extraction exercises in every track. Real string manipulation scenarios, free to start.
Try text exercises →