|Syntax:||MID(S, N1, N2)|
|XLMID(S, N1, N2)|
S = a string value
N1 = a numeric value
N2 = a numeric value
MID returns the substring of length N2 that starts at position N1 in string S.
In MID the index of the first character of S is 0 (zero-based indexing). In XLMID the index of the first character of S is 1 (one-based indexing) for compatibility with Excel's MID function. Otherwise, the two functions are identical.
If N1+N2 is greater than the length of S, then the substring starting at position N1 in S is returned. The first character in string S is in position zero.
T5 = ``Spreadsheet''
MID(T5, 6, 5) = ``sheet''
XLMID(T5, 7, 5) = ``sheet''
XLMID(T5, 11, 1) = ``t''
XLMID(T5, 12, 1) = ``t''
MID(T5, 0, 1) = ``S''
XLMID(T5, 0, 1) = Error - index out of range
MID(T5, 0, 1) = Error - index out of range (in Excel compatibility mode)
Excel function: XLMID is compatible with Excel's MID (In Excel compatibility mode, the ``XL'' prefix is not used.)