This post will guide you how to use Google Sheets MID function with syntax and examples.
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.
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.
start_numis less than 1, the MID function will return the #VALUE! Error value.
num_charsis negative, MID will return the #VALUE! Error value.
- If you want to extract a substring from
start_numto 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_charsargument 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”
#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”
#3 if text value is a number, and the returned value is also a text by MID function:
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.
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])…