Excel MID Function

HomeExcel Functions List (Top 100) Examples + Sample FileExcel MID Function (Example + Sample File)

What is EXCEL MID FUNCTION

The Excel MID Function is listed under Microsoft Excel's Text Functions category. It returns a substring from a string using a specific position and number of characters. In simple words, with MID, you can extract a sub-string from a string by specifying the starting character and number of characters you want to extract.

How to use it

To learn how to use the MID function in Excel, you need to understand its syntax and arguments:

Syntax

MID(text,start_num,num_chars)

Arguments

  • text: A text or a number from which you want to extract characters.
  • start_char: A number for the position of the character from where you want to extract characters.
  • num_chars: The number of characters you want to extract from the start_char.

Notes

  • You can’t specify start_char less than 1 and if you do, it will return an error.
  • If you specify num_chars as 0, it will return nothing & if you specify it as a negative number it will return an error.
  • You can’t refer to more than one cell and If you do that it will return the characters from the top right cell of the range.
  • If the start_char is greater than the length of the text, then it will return and blank.

Example

To master the MID function we need to try it out in an example, so make sure to check out the below one:

In the below example, we have used different values:

  • From the 6th character to the next 6 characters.
  • From the 6th character to the next 10 characters.
  • We have used starting a character in negative and it has returned an error.
  • By using 0 for the number of characters to extract and it has returned a blank.
  • With a negative number for the number of characters to extract and it has returned an error.
  • The starting number is zero and it has returned an error.
  • Text string directly into the function.

Related functions

This tutorial is the part of our Excel Functions with Examples (Function Guide) and below are some of the related functions:

About the Author

Puneet Gogia

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can find him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.