ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value as part of another value (https://www.excelbanter.com/excel-programming/416574-value-part-another-value.html)

Peter Hesselager

Value as part of another value
 
Hi group
I need a way to check, if StreetAdress_1 is part of StreetAdress_2
Really im comparing 2 adresslists by streetname, but I want to omit the
housenumber, which is not all accurate.
Any Idea's ?

--
Med venlig hilsen
Peter Hesselager-Olesen
SBS-IT Aps


JLGWhiz

Value as part of another value
 
That is a space between the double quotes, not a null string.

If Left(StreetAddress_1, InStr(StreetAddress_1, " ") - 1) _
= Left(StreetAddress_2, InStr(StreetAddress_2, " ") - 1) Then
'Do something
End If

I did not test this so there could be errors, but basically use the Left
function
and the InStr function in tandem to designate the point in the string that
you want to
evaluate. This would only compare everything up to the first space, so if
your street name has more than one word, it might not work so good.
"Peter Hesselager" wrote:

Hi group
I need a way to check, if StreetAdress_1 is part of StreetAdress_2
Really im comparing 2 adresslists by streetname, but I want to omit the
housenumber, which is not all accurate.
Any Idea's ?

--
Med venlig hilsen
Peter Hesselager-Olesen
SBS-IT Aps


JLGWhiz

Value as part of another value
 
Peter, disregard that. I had my head backward. The street number comes
first in the U.S. So, it would have to use a Mid Function in tandem with a
InStr and Len function to work out the math so that only the street name
would be returned.

"Peter Hesselager" wrote:

Hi group
I need a way to check, if StreetAdress_1 is part of StreetAdress_2
Really im comparing 2 adresslists by streetname, but I want to omit the
housenumber, which is not all accurate.
Any Idea's ?

--
Med venlig hilsen
Peter Hesselager-Olesen
SBS-IT Aps


Peter Hesselager

Value as part of another value
 
Hi
I worked the same idea, but some street names have more than one space (
South Street 7 ).

To overcome this problem I decided to test if StreetAdress1 (value now being
only "South") is part of ( is contained in -) StreetAdress2, which remains
unchanged ( South Street 7 )
I know it's not perfect - but the way data are, it will produce only a few
"mistakes"

When using the ordinary AutoFiltering in excel, you have the possibility to
filter for Value "contained in" ....

Is there a similar VB-expression to use on this problem ??


--
Med venlig hilsen
Peter Hesselager-Olesen
SBS-IT Aps



"JLGWhiz" skrev:

Peter, disregard that. I had my head backward. The street number comes
first in the U.S. So, it would have to use a Mid Function in tandem with a
InStr and Len function to work out the math so that only the street name
would be returned.

"Peter Hesselager" wrote:

Hi group
I need a way to check, if StreetAdress_1 is part of StreetAdress_2
Really im comparing 2 adresslists by streetname, but I want to omit the
housenumber, which is not all accurate.
Any Idea's ?

--
Med venlig hilsen
Peter Hesselager-Olesen
SBS-IT Aps



All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com