MID

You can use the MID function when you need specific characters from a text item. MID returns one or more characters from a text item.

Syntax:

MID (single-text-expression, single-number-expression,
single-number-expression)

Meaning:
MID (source_text, position_to_start_the_search, number_of_characters)
Returns:
A single text item

MID extracts one or more characters from source_text where position_to_start_the_search is the position of the first character to extract and number_of_characters specifies the number of characters to extract. The first character (leftmost) of source_text has a starting position of 1.

If position_to_start_the_search is greater than the length of source_text, MID returns "none". If position_to_start_the_search or number_of_characters is less than one, MID returns "none". If the rightmost number of characters of source_text, starting at position_to_start_the_search, is less than number_of_characters, MID returns the rightmost characters starting at the position specified in position_to_start_the_search.

Examples

  • MID ("abc123", 5 , 3)

    Returns 23

  • MID ("abc123", 7 , 1)

    Returns "none" because argument2 is larger than the number of characters in argument1

  • MID ("abc123", -1 , 3)

    Returns "none" because argument2 is a negative number

  • MID ("abc123", 2 , -2)

    Returns "none" because argument3 is a negative number

Related functions

  • FIND
  • LEFT
  • RIGHT

Feedback