How to mid extract substring in Excel
Extract a department code embedded in the middle of a product ID, or pull the month from a date-formatted text string.
Step-by-step instructions
How to mid extract substring — 3 steps
Identify the position of the first character you want — counting from the left, starting at 1.
Enter that position as the second argument.
Enter the number of characters you want to extract as the third argument.
Example data
Worked example
| Product ID | Dept Code |
|---|---|
| XYZ-HR-001 | HR |
| XYZ-FN-042 | FN |
| XYZ-IT-108 | IT |
Common mistakes
Errors to watch out for
Returns wrong characters
MID starts counting at position 1, not 0. If your result is off by one character, subtract 1 from the start position.
Returns empty string
If the start position is greater than the total length of the string, MID returns an empty string rather than an error.
FAQ
Frequently asked questions
How do I use MID when the start position varies?
Combine MID with FIND to locate a delimiter dynamically — for example, =MID(A2, FIND("-",A2)+1, 3) extracts 3 characters starting right after the first hyphen.
Describe your exact spreadsheet problem — get the formula in seconds.
Open AI Formula Generator — FreeRelated how-to guides