Features of !SEMTools

MID

MID function examples
MID – simplest usage examples
Function categoryText
VolatilityNon-volatile
Similar functionsLEFT, RIGHT

What does the MID function do in Excel?

MID extracts a text fragment from the middle of a text string.
The function needs to know at which position the fragment to extract begins and how many characters to select.
If the number of characters to select exceeds what’s available, only the available characters will be selected.

MID syntax

=MID(text, start_num, num_chars)

Formatting

Similar to LEFT and RIGHT.

MID usage examples

Example 1

This example shows how to extract a variable-length element that is located inside text.
In this case, it’s the middle name within a full name.
The extracted name text is always located between the first and second space.

MID - extracting the second word
Extracting middle name from full name using the MID function

Example 2

The MID function is used to extract from a string the first word containing a specific fragment.
The SUBSTITUTE function in combination with REPT creates a large number of spaces between words to guarantee extracting only one word with extra spaces on the right and left.
The TRIM function then removes them.

MID - extracting word by pattern
Extracting words containing a specific pattern using the MID function

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.

This post is also available in RU.