Function Reference: MID
| Syntax | ||
| =MID(text,start,num_chars) | ||
| Purpose / Description | ||
| Returns a text string containing one or more characters from the middle of a text string. | ||
| Arguments | ||
| Name | Type | Description |
| text | text string | A constant, reference or nested expression which provides the text string from which characters are to be extracted. |
| start | number | A constant, reference or nested expression which provides the starting location of the first character to be extracted, counting from 1 at the beginning of the string. |
| num_chars | number | A constant, reference or nested expression which specifies how many characters are to be returned from the text string. |
| Return Values | ||
| Type | Specific Value | Description |
| text string | A text string containing the specified number of characters from the middle of text. | |
| error | #VALUE! | If num_chars is not a number and cannot be coerced to a number. If num_chars is a number < 0. |
| error | Any errors referenced by arguments are returned due to propagation of error values. | |
| Notes / Comments / Advice / Warnings | ||
| Note: | If text is a blank cell, an empty string, num_chars is 0 or start > the character count in text, the text string returned is an empty string (""). | |
| Note: | If the value of num_chars exceeds the count of characters between start and the end of the text string in text, then the entire contents of the text string, beginning at the starting position is returned. | |
| Examples: | Open / download sample workbook: LEFT, RIGHT, MID.xlsx | |