Back to functions
Text2026-03-143 related articles

MID Function in Excel

Return characters from the middle of a text string based on a start position and length.

Syntax

MID(text, start_num, num_chars)

Arguments

text

Required

The source text string.

start_num

Required

The position of the first character to return.

num_chars

Required

The number of characters to extract.

What it returns

Returns the requested substring from the original text.

What MID does

MID extracts characters from inside a text string. You tell Excel where to start and how many characters to return.

It is useful for parsing codes, IDs, serial numbers, and semi-structured text imported from other systems.

Practical examples

Pull a section from a fixed code

=MID(A2,4,3)

This returns three characters starting from the fourth character in A2.

Extract a month code or sequence

MID becomes especially effective when your text follows a fixed pattern and the positions are reliable.

Common mistakes and notes

Counting starts at 1

Excel counts the first character as position 1, not 0.

MID is best with consistent patterns

If the source text has variable spacing or inconsistent separators, you may need cleanup or a different parsing approach first.

Related functions

Related articles

Deep dives, troubleshooting guides, and practical examples that use MID.

Official documentation