=MIDB(text,start_num,num_bytes)
=MIDB(A2,1,5)
The MIDB function returns a portion of a string, starting at the character specified by the second argument and n number of characters specified by the third argument. For example, this returns the fifth character from the string in A2, starting at the 1st character.
=MIDB(A2,7,20)
If the number of characters to return (the third argument) is greater than the length of the string, all characters, beginning with the character specified by the second argument, are returned. For example, this returns the 20th character from the string in A2, starting at the 7th character. Because the number of characters to return (20) is greater than the length of the string (10), all characters, beginning with the 7th, are returned. No empty characters (spaces) are added to the end.
=MIDB(A2,LEN(A2)-2,3)
The MIDB function can be used to return the last n characters from a string. For example, if A2 contains the string "Sourcetable", this returns the last 3 characters from the string in A2, starting at the 2nd to last character. This example returns the string "cel".
The MIDB function returns a specified number of characters from a text string, counting each character as one type of byte. It returns an empty text if the start_num is greater than the length of text.