A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Discussion (Misc queries)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Extracting specific info from cells



 
 
Thread Tools Display Modes
  #1  
Old June 14th 12, 11:23 PM
johnhaskell johnhaskell is offline
Junior Member
 
First recorded activity by ExcelBanter: Jun 2012
Posts: 2
Default Extracting specific info from cells

Hello everyone.

I'm looking at a column in Excel full of various addresses. Here's what I'm trying to do:

If and only if an address contains the string "zone" then I want to put that zone number in another column.
For instance, an address might contain "zone 18". I would want the new column to display 18.
This number would always be preceded by the word "zone".

I've tried to do this already using nested IFs, FINDs, SEARCHs, but I'm probably making it way too complicated.

Thanks in advance for any help you all could give.
Ads
  #2  
Old June 15th 12, 02:55 AM posted to microsoft.public.excel.misc
GS[_2_]
external usenet poster
 
Posts: 2,276
Default Extracting specific info from cells

johnhaskell formulated on Thursday :
> Hello everyone.
>
> I'm looking at a column in Excel full of various addresses. Here's what
> I'm trying to do:
>
> If and only if an address contains the string "zone" then I want to put
> that zone number in another column.
> For instance, an address might contain "zone 18". I would want the new
> column to display 18.
> This number would always be preceded by the word "zone".
>
> I've tried to do this already using nested IFs, FINDs, SEARCHs, but I'm
> probably making it way too complicated.
>
> Thanks in advance for any help you all could give.


Hint: according to your example, the number is preceeded by "zone "
which is 5 characters long. The number starts at the 6th character
AFTER the position returned by FIND()! The position returned by FIND()
is where "z" is located.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3  
Old June 15th 12, 01:40 PM posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_]
external usenet poster
 
Posts: 901
Default Extracting specific info from cells

On Thu, 14 Jun 2012 22:23:51 +0000, johnhaskell > wrote:

>
>Hello everyone.
>
>I'm looking at a column in Excel full of various addresses. Here's what
>I'm trying to do:
>
>If and only if an address contains the string "zone" then I want to put
>that zone number in another column.
>For instance, an address might contain "zone 18". I would want the new
>column to display 18.
>This number would always be preceded by the word "zone".
>
>I've tried to do this already using nested IFs, FINDs, SEARCHs, but I'm
>probably making it way too complicated.
>
>Thanks in advance for any help you all could give.


Assuming you have Excel 2007 or later, and that the zone number will not be longer than ten (10) digits:

This formula must be **array-entered**:

=IF(ISERR(SEARCH("zone ",A1)),"",
MAX(IFERROR(--MID(A1,
SEARCH("zone ",A1)+5,ROW(INDIRECT("1:10"))),0)))
----------------------------------------

To **array-enter** a formula, after entering
the formula into the cell or formula bar, hold down
<ctrl><shift> while hitting <enter>. If you did this
correctly, Excel will place braces {...} around the formula.
  #4  
Old June 15th 12, 01:50 PM posted to microsoft.public.excel.misc
GS[_2_]
external usenet poster
 
Posts: 2,276
Default Extracting specific info from cells

Ron,
I didn't offer a solution because John didn't say what, if any, text
follows the number. IOW, we'd need to see a pattern sample of the
entire string!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5  
Old June 15th 12, 04:56 PM
johnhaskell johnhaskell is offline
Junior Member
 
First recorded activity by ExcelBanter: Jun 2012
Posts: 2
Default

Ok for example, a string might say 6 CALLE A 10-47 COLONIA LODELPUENTES ZONA 11 DE MIXCO
(its actually zona, not zone) haha


Quote:
Originally Posted by GS[_2_] View Post
Ron,
I didn't offer a solution because John didn't say what, if any, text
follows the number. IOW, we'd need to see a pattern sample of the
entire string!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
  #6  
Old June 15th 12, 05:27 PM posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_]
external usenet poster
 
Posts: 901
Default Extracting specific info from cells

On Fri, 15 Jun 2012 08:50:13 -0400, GS > wrote:

>Ron,
>I didn't offer a solution because John didn't say what, if any, text
>follows the number. IOW, we'd need to see a pattern sample of the
>entire string!


I believe my solution is independent of what ever might follow the number. However, it does depend on the zone BEING a number (he did describe it as a zone *number*)
  #7  
Old June 16th 12, 01:46 AM posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_]
external usenet poster
 
Posts: 901
Default Extracting specific info from cells

On Fri, 15 Jun 2012 15:56:54 +0000, johnhaskell > wrote:

>Ok for example, a string might say 6 CALLE A 10-47 COLONIA LODELPUENTES
>ZONA 11 DE MIXCO
>(its actually zona, not zone) haha


Did you try my formula, making the obvious change from zone to zona?

=IF(ISERR(SEARCH("zone ",A1)),"",
MAX(IFERROR(--MID(A1,
SEARCH("zona ",A1)+5,ROW(INDIRECT("1:10"))),0)))
  #8  
Old June 16th 12, 01:49 AM posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_]
external usenet poster
 
Posts: 901
Default Extracting specific info from cells

On Fri, 15 Jun 2012 15:56:54 +0000, johnhaskell > wrote:

>
>Ok for example, a string might say 6 CALLE A 10-47 COLONIA LODELPUENTES
>ZONA 11 DE MIXCO
>(its actually zona, not zone) haha
>
>


My previous alteration was incorrect as zone is used twice:

=IF(ISERR(SEARCH("zona ",A1)),"",
MAX(IFERROR(--MID(A1,
SEARCH("zona ",A1)+5,ROW(INDIRECT("1:10"))),0)))

and be sure to enter this as an **array formula** as I described in my original response.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting specific info from text cell. Chipgiii Excel Programming 3 January 26th 10 06:44 PM
extract specific info from cells in a column Herman New Users to Excel 1 October 27th 05 03:01 AM
Extracting specific data from cells AndyUK[_2_] Excel Programming 0 November 11th 04 02:53 PM
Extracting specific data from cells AndyUK Excel Programming 1 November 11th 04 02:32 PM
Extracting Specific Information in Cells JHawaii Excel Programming 0 September 11th 03 05:43 PM


All times are GMT +1. The time now is 03:17 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004-2013 ExcelBanter.
The comments are property of their posters.