All guides

The MID Function (and LEFT, RIGHT) in Excel

MID pulls a specific chunk of characters out of the middle of a text string, given a starting position and a length. Together with LEFT (characters from the start) and RIGHT (characters from the end), it's how you break apart text that doesn't come with its own delimiter — codes, IDs, or fixed-format strings pasted in from another system.

Worked example

=MID(A2, 4, 2)

If A2 is "INV-24-0091", returns "24" — 2 characters starting at position 4

Position 1 is the very first character; count delimiters as characters too.

LEFT and RIGHT for the simpler cases

=LEFT(A2, 3) returns the first 3 characters; =RIGHT(A2, 4) returns the last 4. Use these when what you need is anchored to one end of the string rather than sitting in the middle.

Finding the position dynamically with FIND

Hard-coding a start position only works when every row has the exact same format. For variable-length text, combine MID with FIND to locate a delimiter first: =MID(A2, FIND("-",A2)+1, 2) finds the first hyphen and starts extracting right after it.

Practice this for real

Try the "Working with Text" exercises

Type the formula into a real spreadsheet and get instant feedback.

Related guides