MID takes three arguments, all of which are required.

The firstargument,text, is the text string to start with.

The second argument,start_num, is the position of the first character to extract.

MID function example - extract date from serial number

The third argument,num_chars, is the number of characters to extract.

Ifnum_charsis greater than the number of characters available, MID returns all remaining characters.

This can be done by combining MID with the FIND function.

MID function example - extract date from serial number

We then subtract 1 and the result goes into the MID function as thenum_charsargument.

This too can be accomplished by combining MID with the FIND function.

In the worksheet below, the goal is to return the domain portion of each email address.

MID function example - extract date from serial number

We then add 1 to the result from FIND to start at thenextcharacter.

Fornum_chars, we hardcode 100.

This is a simple hack.

MID function example - extract date from serial number

Whennum_charsexceeds the characters that remain in a text string, MID returnsall remaining characters.

We take advantage of this behavior by providing an arbitrarily large number that will work in all cases.

In the example below, a formula is used to flag serial numbers that contain “2021”.

MID function example - extract date from serial number

The result is then compared to “2021” as the logical test inside the IF function.

When the result is TRUE, IF returns “x”.

Otherwise, IF returns an empty string ("").

MID function example - extract name from email address

The result is that serial numbers that contain “2021” are clearly identified.

The results is an array that contains all characters in the text string.

Seethis pagefor a full explanation.

MID function example - extract domain from email address

Use theMID functionto extract from themiddleof a text string.

TheLEN functionreturns the length of text as a count of characters.

UseFINDorSEARCHto locate an unknown starting or ending position.

MID function example - flag data that contains specific info

For example, =LEFT(“apple”,3) returns “app”.

For example, =RIGHT(“apple”,3) returns “ple”.

For example, =MID(“apple”,2,3) returns “ppl”.

Excel formula: Strip numeric characters from cell

LEN will also count characters in numbers, but number formatting is not included.

TEXTBEFORE Function

The Excel TEXTBEFORE function returns the text that occurs before a given substring or delimiter.

TEXTAFTER Function

The Excel TEXTAFTER function returns the text that occurs after a given substring or delimiter.

Excel formula: Basic outline numbering

TEXTSPLIT can split text into rows or columns.

Excel formula: Strip non-numeric characters

Excel formula: Abbreviate names or words

Excel formula: Get page from URL

Excel formula: Get middle name from full name

Excel formula: Split text string to character array

Excel formula: Get sheet name only

Excel formula: Get last name from name

Excel formula: List sheet names with formula

Excel formula: Count numbers in text string

Excel formula: Split dimensions into three parts

Excel formula: Get work hours between dates custom schedule

Excel formula: LAMBDA strip characters

Excel formula: Convert text to date

Excel LEFT function

Excel RIGHT function

Excel MID function

Excel LEN function

Excel TEXTBEFORE function

Excel TEXTAFTER function

Excel TEXTSPLIT function

MID function example - extract date from serial number

MID function example - extract name from email address

MID function example - extract domain from email address

MID function example - flag data that contains specific info