Log in  \/ 
x
or
x
x
Register  \/ 
x

or

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

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

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, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.