Skip to content
Excel

MID function in Excel

Returns a specific number of characters from a text string starting at the position you specify

=MID(text, start_num, num_chars)

MID syntax and parameters

Three arguments, three required.

  • textstringRequired
  • start_numnumberRequired
  • num_charsnumberRequired

MID examples

Formulas you'll actually reuse.

  1. Characters 5–9 of an order code like NYC-10422-A — the numeric part:

    =MID(A2, 5, 5)

    Result"10422"

  2. The segment between the first and second hyphen, whatever its length:

    =MID(A2, FIND("-", A2) + 1, FIND("-", A2, FIND("-", A2) + 1) - FIND("-", A2) - 1)

    Result"10422"

MID in Google Sheets

Same name — your formula ports as-is.

Try MID in the playground

Edit the example — nothing to install.

Preloaded with the MID formula from Example 1 — change anything and watch it respond.

Loading the editor…

MID errors

What they mean — and the fixes.

  • #VALUE!

    The start position is less than 1 or the length is negative — both must be positive whole numbers.