Solved

Formula to extract cell contents in front of manual line break

Posted on 2013-01-31
4
391 Views
Last Modified: 2013-01-31
Dear Experts:

I got hundreds of cells in a column with manual line breaks (Alt + Enter). I wonder whether it is possible to extract the cell contents in front of the manual line breaks using VBA code or a formula.

I have attached a sample for your convenience.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas

Formula-Extracting-Text-Before-M.xlsx
0
Comment
Question by:AndreasHermle
  • 3
4 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 38839389
=LEFT(B4,SEARCH(CHAR(10),B4)-1)

for example
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 38839419
Note that assumes there is always a line feed. Safer to use

=IFERROR(LEFT(B4,SEARCH(CHAR(10),B4)-1),B4)

:)
0
 

Author Closing Comment

by:AndreasHermle
ID: 38839479
Dear rorya:

I sure love this forum. Thank you very much for your swift and professional support.

Regards, Andreas
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 38839586
Andreas,

You are most welcome. It is always a pleasure to deal with you :)

Rory
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question