Skip to main content

Excel Formula: Extract first line of cell

In sometimes, there are several lines of contents in one Excel cell, if you just want to extract first line of contents into another cell, you can use a formula combined with LEFT function and SEARCH function.
doc extract first line 1

Generic formula:

LEFT(txt, SEARCH(CHAR(10), txt)-1)

Arguments

Txt: the cell contents you want to extract first line from.

Remark

If there is blank or no char(10)(line break) in the text, it returns error value #VALUE!.

How this formula work

To extract first line from cell C3, please use below formula:

=LEFT(C3, SEARCH(CHAR(10), C3)-1)

Press Enter key.
doc extract first line 2

Explanation

CHAR(10): the line break.

SEARCH function finds the starting position of a character or text string in a given text. Here the formula SEARCH(CHAR(10), C3) finds the starting position of CHAR, returns 8.

LEFT function extracts text from left side of a text based on the given position. The formula =LEFT(C3, SEARCH(CHAR(10), C3)-1) can be seen as =LEFT(C3, 8-1), extracts 7 characters from left side of cell C3, returns “Combine”.

Sample File

doc sampleClick to download sample file


Relative Formulas


Relative Functions

  • LEFT function
    Extract text from left side.
  • SEARCH function
    Find a string within another string, and returns the starting position of the string inside another one.
  • IF function
    Test for conditions.
  • MID function
    Extract part of text from a cell value based on the location and length.

The Best Office Productivity Tools


Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations