Extract text between characters with MID and FIND

To extract text between two hyphens, FIND calculates where the delimiters sit and MID uses those positions as its starting point and length. Here it pulls AX42 from SKU-AX42-WEST.

How Excel works this out

Inner to outer

Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.

Runs this calculation on the values.

Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.

Runs this calculation on the values.

Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.

Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.

Runs this calculation on the values.

Pull characters from the middle of a text string with MID, starting at any position you choose.

Formula sample data

How this MID formula works

The first hyphen is character 4, so extraction begins at 5. The second hyphen is character 9, making the slice four characters long; MID returns AX42.

The rows above are ordered from the innermost calculation to the final result. Excel has to finish an inner function before the function around it can use that value. Edit a cell in the grid to see that dependency chain update for real.

Try your own formula and data

The sample spreadsheet is fully editable. Change the formula or any cell it references. The intermediate values recalculate in your browser.

Practice with an exercise

Here is an exercise that uses MID. Type the formula into a real spreadsheet and we will check your answer as you go.

Parse full address

Intermediate

Extract city from a full address string (assume consistent format).

Open exercise

Common mistakes with MID

If this formula is not doing what you expect, one of these is usually why.

Why does this MID FIND formula return #VALUE!?

FIND could not locate one of the expected hyphens. Check that the source text contains both delimiters and that the formula uses the correct character.

Why is the first or last character missing?

The +1 and -1 adjustments define the slice inside the delimiters. Removing or duplicating one shifts the starting point or length.

Is FIND case-sensitive?

Yes. FIND distinguishes uppercase and lowercase text. Use SEARCH when the text match should ignore case.

Is there a simpler formula in modern Excel?

TEXTBEFORE, TEXTAFTER, and TEXTSPLIT can be easier when available. MID and FIND remain useful in older Excel versions and when you need exact positions.