MID

Description

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 Any text string.
start_position

Character to return.

  • 1 — First character in text is returned.
  • Greater than the number of characters in text — An empty string (" ") is returned.
  • 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)

See also

CODE

FIND

LEFT

RIGHT

SEARCH