Excel MID Function
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".
- text - The text to extract from.
- start_num - The location of the first character to extract.
- num_chars - The number of characters to extract.
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.
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"