Exceljet

Quick, clean, and to the point

Excel MID Function

Excel MID function
Summary 

The Excel MID function extracts a given number of characters from the middle of a supplied text string. For example, =MID("apple",2,3) returns "ppl".

Purpose 
Extract text from inside a string
Return value 
The characters extracted.
Syntax 
=MID (text, start_num, num_chars)
Arguments 
  • text - The text to extract from.
  • start_num - The location of the first character to extract.
  • num_chars - The number of characters to extract.
Version 
Usage notes 

The MID function extracts a given number of characters from the middle of a supplied text string. The first argument, start_num is position of the first character to extract. The second argument, num_chars, is the number of characters to extract. If num_chars is greater than the number of characters available, MID returns as many characters as possible.

The MID function is commonly combined with other functions like LEN and FIND to extract text in more complex scenarios. Also, the LEFT function will extract text starting from the left, and the RIGHT function will extract text from the right.

Examples

In the example below, we extract "cat" from "The cat in the hat":

=MID("The cat in the hat",5,3) // returns "cat"

This formula will extract hat:

=MID("The cat in the hat",16,3) // returns "hat"

Notes

  • num_chars is optional and defaults to 1.
  • RIGHT will extract digits from numbers as well as text.
  • Number formatting is not counted or extracted.
  • Use FIND or SEARCH to locate an unknown start position.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.