MID function is used to extract a specified number of characters from a string in both Excel & Google Sheet.
=MID(text, start_num, num_chars)
Input Arguments :
- text – the string from which you want to extract the sub-string.
- start_num – the starting position within the string, from where the extraction should begin.
- num_chars – the total number of characters you want to extract.
In below example, the MID function is extracting 3 characters from the 6th position of the string in A2.
- If the start number is greater than the length of the string, MID returns “” (empty text).
- If the number of characters is 0, MID returns “” (empty text).
- The number of characters cannot be negative.
- The start number cannot be less than 1.
- If the number of characters specified is larger than the total no. of characters in the string, the entire string is returned(beginning from the start number)