# Extract substring

=MID(A1,start,end-start+1)

To extract a substring with an Excel formula, you can use the MID function. In the example shown, the formula in E5 is:

=MID(B5,C5,D5-C5+1)

which, on row 5, returns "Perfect".

*Note: in this example, we are calculating the end position in order to extract a substring with a literal start and end position. However, if you know the number of characters to extract, you can just plug in that number directly.*

In the example on this page, we are using the MID function to extract text based on a start and end position. The MID function accepts three arguments: a text string, a starting position, and the number of characters to extract. The text comes from column B, and the starting position comes from column C. The number of characters to extract is calculated by subtracting the start from end, and adding 1. In cell E6:

### Functions to extract substrings

Excel provides three primary functions for extracting substrings:

Click on function names above for details and linked examples.

### Finding start and end positions with a formula

In the example shown, start and end positions are based on hardcoded values. However, it is possible to calculate positions with the FIND function and SEARCH function. See links below for examples.

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

## Download 200+ Excel Shortcuts

Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.