This post looks at using a couple of text functions together in Excel. The MID and FIND functions are used to extract text from a cell starting from a specified delimiter.
The example below shows a list of five films, each with the year they came out. We want to extract the year from the text and enter it into a different cell. We can then use the year in filters, sorts and PivotTables.
The MID function is used to extract a specified number of characters from a text string. However, it needs a starting character. With these films, the starting position varies between each cell. So, MID will need some help.
The FIND function is used to return the starting position of a character. Because the year is enclosed in brackets, the FIND function can be used to find the opening bracket of each cell and it give its position to the MID function as an index number.
The formula entered in cell B2 is shown below.
=MID(A2,FIND("(",A2)+1,4)
The +1 is used so that the MID function starts from the character after the opening bracket.
Excel has many useful text functions. Notably, the LEFT (beginning) and RIGHT (end) functions are also used to extract text from a cell. The FIND function can also be used with those functions to assist with irregular strings.
Leave a Reply