What is the MID Function
The MID function returns a specified number of characters from the middle of a text string, starting at a position you choose. It is very useful for parsing structured text such as codes, IDs, and dates embedded in strings.
Formula: =MID(text, start_num, num_chars)
Practical Example 1
A2 contains EMP-2024-567. Extract 2024.
Type: =MID(A2, 5, 4)
Result: 2024
Practical Example 2
Extract the last 3 characters.
Type: =MID(A2, 10, 3)
Result: 567
Practical Example 3
Combine MID with FIND to extract text between two delimiters.
Type: =MID(A2, FIND(-, A2) + 1, FIND(-, A2, FIND(-, A2) + 1) - FIND(-, A2) - 1)
Result: the text between the first and second dash
Practical Example 4
Extract the month from a string like 2026-10-17.
Type: =MID(A2, 6, 2)
Result: 10
When to Use It
MID is used for parsing codes and IDs, for extracting dates from strings, for splitting fixed-width data, and for any text where you need to pull characters from the middle.