Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.
- Text to find
"-"- Text to search
A2
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.
Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.
"-"A2Runs this calculation on the values.
FIND("-",A2)11Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.
"-"A2Runs this calculation on the values.
FIND("-",A2)11Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.
"-"A2FIND("-",A2)+1The character position in the main text where the search should start. If omitted, the search starts at the beginning of the text.Locate the position of a text string inside another text string with Excel's case-sensitive FIND function.
"-"A2Runs this calculation on the values.
FIND("-",A2,FIND("-",A2)+1)FIND("-",A2)11Pull characters from the middle of a text string with MID, starting at any position you choose.
A2The text string you want to pull characters from.FIND("-",A2)+1The position of the first character to extract. The first character in the text is position 1.FIND("-",A2,FIND("-",A2)+1)-FIND("-",A2)-1How many characters to return, starting at Start_num.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.
The sample spreadsheet is fully editable. Change the formula or any cell it references. The intermediate values recalculate in your browser.
Here is an exercise that uses MID. Type the formula into a real spreadsheet and we will check your answer as you go.
Extract city from a full address string (assume consistent format).
Open exerciseIf this formula is not doing what you expect, one of these is usually why.
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.
The +1 and -1 adjustments define the slice inside the delimiters. Removing or duplicating one shifts the starting point or length.
Yes. FIND distinguishes uppercase and lowercase text. Use SEARCH when the text match should ignore case.
TEXTBEFORE, TEXTAFTER, and TEXTSPLIT can be easier when available. MID and FIND remain useful in older Excel versions and when you need exact positions.