Solved

Pull out address field

Posted on 2013-05-21
4
207 Views
Last Modified: 2013-05-21
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
Comment
Question by:cansevin
4 Comments
 
LVL 19

Expert Comment

by:helpfinder
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

by:WebDevEM
ID: 39184530
That will work, or you can do it in a single formula by using
=RIGHT(B1,LEN(B1)-FIND(CHAR(10),B1))

Open in new window

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 92

Accepted Solution

by:
Patrick Matthews earned 500 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

by:cansevin
ID: 39184545
Thanks! Worked!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now