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.

1
Choose source text This is the string to read
2
Pick a start position The first character is position 1
3
Return the chosen length Excel extracts that many characters

MID syntax & arguments

Syntax

=MID(text, start_num, num_chars)
Required Optional
  1. 1

    text

    Required

    The text value, cell reference, or formula result to extract characters from.

  2. 2

    start_num

    Required

    The character position where extraction should begin. The first character in text is position 1.

  3. 3

    num_chars

    Required

    How 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_num of 1 starts at the first character. A value below 1 returns a #VALUE! error.

  • The length must not be negative

    num_chars of 0 returns an empty string, while a negative value returns a #VALUE! error.

  • Long lengths stop at the end

    If num_chars reaches 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.

Open full problem

Advanced MID practice problems

Use MID alongside other Excel functions in realistic, less-prescriptive challenges.