Google Sheets MID Function

This post will guide you how to use Google Sheets MID function with syntax and examples.

Description


The Google Sheets MID function returns a substring (a specified number of the characters) starting from the middle of a text string.

The MID function can be used to extract a given number of characters from the middle of a text string in google sheets. It returns a substring  from a text string at the position that you specify.

The MID function is a build-in function in Google Sheets and it is categorized as a Text Function.

Syntax


The syntax of the MID function is as below:

= MID (text, start_num, num_chars)

Where the MID function arguments are:

  • text -This is a required argument. The text string that you want to extract substring from.
  • start_num-This is a required argument.  The position of the first character that you want to extract in text string. The index from the left of text string from which to begin extracting. And the first character in text string is the index 1.
  • num_chars-This is a required argument.  The number of the characters that you want to extract from a text string.

Note: 

  • If start_num is greater than the length of text, the MID function will return empty text.
  • If start_num is less than 1, the MID function will return the #VALUE! Error value.
  • If num_chars is negative, MID will return the #VALUE!  Error value.
  • If you want to extract a substring from start_num to the end of text string, and you can use the LEN function to calculate the length of the text string, you should not specify a large number to num_chars argument for this case.
  • If you want to extract a substring beginning with a particular character, and you should use the SEARCH function to get the index of  that character in text string.

Google Sheets MID Function Examples


The below examples will show you how to use google sheets MID Text function to extract a substring from a text string.

#1 To extract 10 characters from the text string in B1, starting at the 5th character, just using the following formula:

=MID(B1,5,10)  //it returns “le sheets”

google sheets mid function

#2 If num_chars value is greater than the length of remaining characters, and the MID function will return all remining characters:

=MID(“google”,3,200)  //it returns “ogle”

google sheets mid function

#3 if text value is a number, and the returned value is also a text by MID function:

=MID(1234,2,2)

google sheets mid function

Note:

You can use the LEFT function to extract substring from the left side of a text string in Google Sheets. And you can also use another function called RIGHT function to extract a substring starting from the right side of the text string. And if you wish to extract a substring starting from the middle position of text string, you can use the MID function in google sheets.

 

Related Functions


  • Google Sheets LEFT Function
    The Google Sheets LEFT function returns a substring (a specified number of the characters) from a text string, starting from the leftmost character.The syntax of the LEFT function is as below:= LEFT(text,[num_chars])…