MID function

Excel MID Function allows you to extract a specific portion of text from a larger text string. It’s like cutting out a piece of a sentence or word from a longer paragraph. This can be really useful when you need to work with text data, such as names, dates, or other information.

Syntax

MID(text, start_num, num_chars)

Arguments

textThe text from which you want to extract a portion.
start_numThe position in the text where you want to start extracting.
num_charsThe number of characters you want to extract from the text.

How to Use

The MID function is straightforward to use. You just need to provide the function with the three arguments mentioned above.

Let’s look at a few examples to see how it works:

Example 1: Suppose you have the text “Excel is awesome” in cell A1, and you want to extract the word “awesome.” You can use the MID function like this:

This formula starts at the 9th character (the space before “awesome”) and extracts 7 characters, giving you “awesome.”

Example 2: If you have a date in cell B1 like “01/15/2023” and you want to extract just the year “2023,” you can use the MID function this way:

This formula starts at the 7th character (the first digit of the year) and extracts 4 characters, giving you “2023.”

Example 3 (Optional): You can also use the MID function to extract a variable-length portion of text. For instance, if you have the text “Hello, World!” in cell C1 and you want to extract everything after the comma and space, you can use the MID function with the FIND function like this:

This formula finds the position of the comma and space using FIND, adds 2 to start after them, and calculates the number of characters to extract based on the length of the text and the position of the comma and space. It extracts “World!” in this case.

These examples demonstrate how the MID function can be a handy tool for extracting specific information from text in Excel.

Tomasz Decker is an Excel specialist, skilled in data analysis and financial modeling.