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.
|LEFT(txt, SEARCH(CHAR(10), txt)-1)|
|Txt: the cell contents you want to extract first line from.|
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.
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”.
- Extract last line of cell
- Trim Text To N Words
Here introduces the formula to extract n words from left side of a text string.
- Split sentence into words
This tutorial provides formulas to separate words of sentence into separated columns.
- Split dollars and cents
To split dollars and cents into two columns with formulas in Excel.
- 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.
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.