MID
Name
Middle
Description
Returns the requested number of characters from a text string starting at the position you specify.
Syntax
MID(Text, Start_num, Num_chars)
Remarks
Arguments are as follows:
Argument | Description |
---|---|
Text | Text string containing the characters you want to extract. |
Start_num | Position of the first character you want to extract in text. The first character in text has a Start_num value of 1. |
Num_chars | Specifies how many characters to return from text. |
The Text argument can be a string, a formula that returns a string, or a reference to a cell containing a string.
Note the following about the Start_num argument:
- If Start_num is greater than the length of text, MID returns "" (empty text).
- If Start_num is less than the length of text, but Start_num plus Num_chars exceeds the length of text, MID returns the characters up to the end of text.
See also CHAR, LEFT, LOWER, PROPER, RIGHT, and UPPER.
Data Type
Accepts string data for the Text argument, numeric data for the Start_num argument, and numeric data for the Num_chars argument. Returns string data. For more information, see Data Type for Each Cell Type.
Example
fpSpread1.Formula = "MID(""wind surfing"", 6, 20)" equals "surfing"