Extract First Line Of Text From Cell In Excel

We have seen cells in excel with sentences spreading over several lines as shown in the example below.

In the below example we see that the sentence is written across lines within a particular cell and we want to extract only the first line of text or sentence from the cell in excel.

extract first line of text from a cell in excel example

We will see in this post how we can extract only the first line from a cell in excel if the values are written on multiple lines.

We will use a simple excel formula to extract the text from left until we find a line feed character which is present where the line ends and acts as a delimiter.

CHAR(10) is the code for linefeed character in excel and we will write a formula to search for this linefeed and extract all the characters of the first line in an excel cell.




Paste the formula =LEFT(A2, SEARCH(CHAR(10), A2)-1) in cell B2 to extract the first line of text from excel cell.

Search function in excel gives us the position of line feed which again is utilized as he second argument to LEFT function which extracts text from the starting until it encounters the line feed character.

Now enter the below formula in cell B2 to extract the first line of text from excel cell.

excel formula to extract first line of text from cell

As you can see, our formula has extracted the first line of text in the cell.

Hope this helped.

Share The Knowledge

Random Posts

Leave a Reply