[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

Posted on 2013-05-21
Medium Priority
258 Views
I have a column of cells (B) with addresses in this format:

3636 Bravata Dr
Huntington Beach, CA 92649

Everytime the street is followed by a "Enter" before the city.

In column C I need to pull out just the street address (the top line). Any idea the formula for this?
0
Question by:cansevin

LVL 19

Expert Comment

ID: 39184506
you can do it this way, but 2 steps are required.
In 1st step you will substitute Enter (new line) character to another and in 2nd step you will separate what was on the first line in original cell.
Assume you have your address in A1 cell, then in B1 use this formula =SUBSTITUTE(A1;CHAR(10);";")
In step 2, select B1, do Text to columns (divider will be ";" sign) and you will have what you need in C1 (the text following ";" will be in D1 and you can delete it if you do not need it

also you can see it in my sample
sample.xlsx
0

LVL 9

Expert Comment

ID: 39184530
That will work, or you can do it in a single formula by using
``````=RIGHT(B1,LEN(B1)-FIND(CHAR(10),B1))
``````
in Column C.  It looks for the position of Char(10) and takes everything to the right of it as the new value in Column C.

WebDevEM
0

LVL 93

Accepted Solution

Patrick Matthews earned 2000 total points
ID: 39184535
Or to do it in one step, use a formula like this:

=LEFT(B2,FIND(CHAR(10),B2&CHAR(10))-1)

Note that my formula will return the whole contents of B2 if there is no line break.

You could use just =LEFT(B2,FIND(CHAR(10),B2)-1) but that will return an error if there is no line break.
0

Author Closing Comment

ID: 39184545
Thanks! Worked!
0

## Featured Post

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
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…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
###### Suggested Courses
Course of the Month18 days, 18 hours left to enroll