PC Review


Reply
Thread Tools Rate Thread

How do I do a Reverse Find/Search in Excel?

 
 
=?Utf-8?B?TnVtYmVyRG9jYw==?=
Guest
Posts: n/a
 
      27th Feb 2006
I am trying to parse addresses into their basic components (I.E. "123 Main
Street" becomes "123", "Main", "Street") in an Excel Spreadsheet, for later
conversion into a Relational DB.

If H2 = 123 Main Street
To get the Address number (D3): TRIM(MID(H2,1,FIND(" ",H2,1)))
To get the street name (E3):TRIM(MID(H3,LEN(D3)+1,FIND("
",H3,LEN(D3)+1)+LEN(D3)+1))
To get the street type (F3): TRIM(MID(H3,FIND(E3,H3)+LEN(E3),LEN(H3)))

My problem is when the street name is two words (North Main Street). I get
a street name of North and a street type of Main Street. It is also possible
that the street may have a 3 word name.

My first qusetion is how can I do a search starting from the right (RIGHT
function does not do it) to find the last word in the string?

Also, is there a cleaner way to parse the strings than I have done?

Thanks for you help.


 
Reply With Quote
 
 
 
 
Peo Sjoblom
Guest
Posts: n/a
 
      27th Feb 2006
This formula will extract the last word in a string when there is a space
before the last word

=RIGHT(A1,LEN(A1)-SEARCH("^^",SUBSTITUTE(A1,"
","^^",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

with string in A1

I see nothing wrong with your parsing, there are things you can do after you
have extracted a string, you can use substitute to eliminate that string
from the rest and just use the cell where you parsed that string
Parsing is notoriously difficult in Excel and there are always exceptions to
name rules that it will choke on

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




"NumberDocc" <(E-Mail Removed)> wrote in message
news:8590C21F-5A95-4DA3-94A6-(E-Mail Removed)...
>I am trying to parse addresses into their basic components (I.E. "123 Main
> Street" becomes "123", "Main", "Street") in an Excel Spreadsheet, for
> later
> conversion into a Relational DB.
>
> If H2 = 123 Main Street
> To get the Address number (D3): TRIM(MID(H2,1,FIND(" ",H2,1)))
> To get the street name (E3):TRIM(MID(H3,LEN(D3)+1,FIND("
> ",H3,LEN(D3)+1)+LEN(D3)+1))
> To get the street type (F3): TRIM(MID(H3,FIND(E3,H3)+LEN(E3),LEN(H3)))
>
> My problem is when the street name is two words (North Main Street). I
> get
> a street name of North and a street type of Main Street. It is also
> possible
> that the street may have a 3 word name.
>
> My first qusetion is how can I do a search starting from the right (RIGHT
> function does not do it) to find the last word in the string?
>
> Also, is there a cleaner way to parse the strings than I have done?
>
> Thanks for you help.
>
>


 
Reply With Quote
 
=?Utf-8?B?TnVtYmVyRG9jYw==?=
Guest
Posts: n/a
 
      27th Feb 2006
Peo,

Thanks for the code. I'm going to sit down with it and learn how it works
(after this is done).

"Peo Sjoblom" wrote:

> This formula will extract the last word in a string when there is a space
> before the last word
>
> =RIGHT(A1,LEN(A1)-SEARCH("^^",SUBSTITUTE(A1,"
> ","^^",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
>
> with string in A1
>
> I see nothing wrong with your parsing, there are things you can do after you
> have extracted a string, you can use substitute to eliminate that string
> from the rest and just use the cell where you parsed that string
> Parsing is notoriously difficult in Excel and there are always exceptions to
> name rules that it will choke on
>
> --
>
> Regards,
>
> Peo Sjoblom
>
> Northwest Excel Solutions
>
> www.nwexcelsolutions.com
>
> (remove ^^ from email address)
>
> Portland, Oregon
>
>
>
>
> "NumberDocc" <(E-Mail Removed)> wrote in message
> news:8590C21F-5A95-4DA3-94A6-(E-Mail Removed)...
> >I am trying to parse addresses into their basic components (I.E. "123 Main
> > Street" becomes "123", "Main", "Street") in an Excel Spreadsheet, for
> > later
> > conversion into a Relational DB.
> >
> > If H2 = 123 Main Street
> > To get the Address number (D3): TRIM(MID(H2,1,FIND(" ",H2,1)))
> > To get the street name (E3):TRIM(MID(H3,LEN(D3)+1,FIND("
> > ",H3,LEN(D3)+1)+LEN(D3)+1))
> > To get the street type (F3): TRIM(MID(H3,FIND(E3,H3)+LEN(E3),LEN(H3)))
> >
> > My problem is when the street name is two words (North Main Street). I
> > get
> > a street name of North and a street type of Main Street. It is also
> > possible
> > that the street may have a 3 word name.
> >
> > My first qusetion is how can I do a search starting from the right (RIGHT
> > function does not do it) to find the last word in the string?
> >
> > Also, is there a cleaner way to parse the strings than I have done?
> >
> > Thanks for you help.
> >
> >

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find a number in Excel file using search deeds Microsoft Excel Misc 5 15th May 2010 12:04 AM
Re: Excel macro - search/find function Don Guillett Microsoft Excel Programming 3 10th Jun 2009 04:07 PM
How to find text in Word in reverse direction: edit find previous =?Utf-8?B?RGF2aWQgTWFucGVhcmw=?= Microsoft Word Document Management 1 26th Jan 2007 06:28 PM
is there an equal fxn for 'InStr' in excel. Not Find or Search =?Utf-8?B?Q2xhdXNpdXM=?= Microsoft Excel Worksheet Functions 2 30th Jun 2005 08:37 PM
Reverse Search/find on Outlook =?Utf-8?B?TWFyeSBBbGV4YW5kZXI=?= Microsoft Outlook Calendar 1 30th Apr 2005 04:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:44 PM.