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.
Characters 5–9 of an order code like NYC-10422-A — the numeric part:
=MID(A2, 5, 5)Result
"10422"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.
Related functions
More ways Excel gets this done.
- ARRAYTOTEXTReturns an array of text values from any specified rangeTextNo Google Sheets equivalent
- CHARReturns the character specified by the code numberTextGoogle Sheets
- CLEANRemoves all nonprintable characters from textTextGoogle Sheets
- CODEReturns a numeric code for the first character in a text stringTextGoogle Sheets
- CONCATCombines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments.TextGoogle Sheets
- CONCATENATEJoins several text items into one text itemTextGoogle Sheets