MID
Description
MID returns the specified number of characters from a text string, beginning with the specified starting position.
Syntax
MID ( text, start_position, num_chars )
Parameter |
Description |
text |
The string from which to return characters. |
start_position |
The position of the first character to return from text. |
|
If start_position is 1, the first character in text is returned. If start_position is greater than the number of characters in text, an empty string (" ") is returned. If start_position is less than 1, #VALUE! is returned. |
num_chars |
The number of characters to return. If num_chars is negative, #VALUE! is returned. |
Remarks
If start_position plus the number of characters in num_chars exceeds the length of text, the characters from start_position to the end of text are returned.
Examples
This function returns Expenses:
MID("Travel Expenses", 8, 8)
This function returns 45:
MID("Part #45-7234", 7, 2)
With Latin letters, one letter is one byte. That is why MID and MIDB are identical.
Note:
If an Invalid formula syntax warning appears, check whether the comma is set as the list separator in your regional settings on the Windows Control Panel. If a different character is set as the list separator, use this character in the above examples in place of the comma. (Windows XP: Access the Windows Control Panel and select Regional and Language Options. On the Regional Options tab page, click Customize. On the Numbers tab page, check which character is the default list separator on your computer. Use this character in the above examples instead of the comma.
Also, see