A common task in data analysis is to extract parts or chunks from a string.
In this example we are going to see how we can extract the first 2 characters from a string in Excel.
Start by entering some data in Column A

Above we have a column with some IDs – here we want the prefix only – the first 2 characters – and put them in Column B.
We are going to make use of the =LEFT function here. This function is used to retreive a chosen number of characters, counting from the left hand side.
In Cell B2 – enter the following formula:
=LEFT(A2;2)
The formula says, look in cell A2 – and get 2 charactes starting from the left hand side.

Drag the formula down to cover all the cells.



Leave a comment