Documentation/Calc Functions/MID/en

Function name:
MID

Category:
Text

Summary:
Extracts a sub-string from the middle of the supplied text string, with the start position and length of the sub-string specified in characters.

Syntax:
MID(Text; Start; Number)

Returns:
Returns a text string comprising the specified number of characters from the specified position within the supplied text string.

Arguments:
Text is a text string (in quotation marks), a number, or a reference to a cell containing one of those types, that is the string from which characters are to be extracted.

Start is a positive integer, or a reference to a cell containing a positive integer, that is the position of the first character to be extracted.

Number is a non-negative integer, or a reference to a cell containing a non-negative integer, that is the number of characters to be extracted.


 * If either Start or Number is non-numeric, then MID reports a #VALUE! error.
 * If either Start or Number is a non-integer value, then MID truncates it to an integer value.
 * If after truncation Start is less than 1, then MID reports an invalid argument error (Err:502).
 * If after truncation Start is greater than the length (in characters) of Text, then MID returns the empty string.
 * If Number is less than 0, then MID reports an invalid argument error (Err:502).
 * If after truncation Number is equal to 0, then MID returns the empty string.
 * If (Start + Number – 1) is greater than the length (in characters) of Text, then MID returns a string comprising all characters from Start to the end of Text.

Additional details:
Note that  is equivalent to

Related LibreOffice functions:
LEFT

MIDB

RIGHT

ODF standard:
Section 6.20.15, part 2

Equivalent Excel functions:
MID