Excel MID Function
MID returns a specific number of characters from the middle of a text value.
Use it to extract embedded codes, fixed-position segments, product categories, or text between known positions inside an identifier.
MID syntax & arguments
Syntax
=MID(text, start_num, num_chars)
-
1
text
RequiredThe text value, cell reference, or formula result to extract characters from.
-
2
start_num
RequiredThe character position where extraction should begin. The first character in
textis position 1. -
3
num_chars
RequiredHow many characters to return starting at
start_num.
Example
=MID(A2, 4, 3)
Return three characters from A2 starting at character 4.
MID caveats
-
Positions start at 1
start_numof1starts at the first character. A value below1returns a#VALUE!error. -
The length must not be negative
num_charsof0returns an empty string, while a negative value returns a#VALUE!error. -
Long lengths stop at the end
If
num_charsreaches past the end of the text, MID returns the remaining characters instead of padding the result. -
Dates and numbers may need formatting first
MID reads text characters, so use TEXT first when a number or date needs a specific display format before extraction.
Need a dynamic start? Combine MID with FIND or SEARCH when a delimiter decides where extraction should begin. Use LEFT or RIGHT when the needed text starts at an edge.
Intro MID practice problem
Solve the intro problem directly here, or open it on its own page.
Advanced MID practice problems
Use MID alongside other Excel functions in realistic, less-prescriptive challenges.