Quick Answer

MID Function

MID extracts characters from the middle of a text string at a specified starting position.

✓ Excel✓ Google SheetsExcel All versions

Syntax

MID
(text, start_num, num_chars)

Parameters

ParameterDescriptionRequired
textThe text string from which to extract characters.Required
start_numThe starting position of the extraction (1-based).Required
num_charsThe number of characters to extract.Required

Basic Example

Extract 5 characters starting at position 7

=MID("Hello World", 7, 5)
ResultWorld

Extracts 5 characters starting from position 7 in "Hello World".

Advanced Examples

Example 1: Extract middle initial from name

Name parsing

Get the middle initial from "John D. Smith"

=MID(A1, FIND(" ", A1)+1, 1)
Result: D
Finds the first space, then extracts one character after it.

Example 2: Extract substring between two delimiters

Data extraction

Get text between two dashes

=MID(A1, FIND("-", A1)+1, FIND("-", A1, FIND("-", A1)+1)-FIND("-", A1)-1)
Result: middle
Extracts text between the first and second dash.

How MID Works

MID starts at the specified position (1-based) and extracts the specified number of characters. Position 1 is the first character.

1
Select output cell
Choose where the result should appear.
2
Enter formula
Type =MID(text, start_position, number_of_characters).
3
Press Enter
The result shows the extracted text.

Important Notes & Limitations

  • start_num must be at least 1.

  • If start_num + num_chars exceeds the text length, MID returns as many characters as available.

Common Errors & Fixes

#VALUE!start_num is less than 1

Fix: Ensure start_num is at least 1.

Download Practice File

Practice MID with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the MID function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Is MID position 0-based or 1-based?
MID is 1-based — the first character is position 1.
Can MID extract to the end of the string?
Yes, use a large num_chars value or calculate it with LEN.