Help with comparing two columns and pulling non-matching data

Bfish

New Member
Joined
Oct 4, 2010
Messages
24
Hello all sorry if this has been asked before but I could use some help. I have an excel sheet with two columns of data. Column A contains a street address, column B contains the street address plus the city name. I would like to pull the city name from column B and put it in column C OR just delete the street address from column B leaving just the city name(whichever would be easier). Example data below:

Column A Column B
100 Division Street 100 Division Street Ansonia
1135 Famington Avenue 1135 Famington Avenue Berlin
313 Cottage Grove Road 313 Cottage Grove Road Bloomfield
11 East High St. 11 East High St. East Hampton


As you can see the city will not always be just one word so just removing the last word won't work in this situation. Any help would be greatly appreciated.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
This probably isnt going to work every time but might get you somewhere
Try

in C1
=TRIM(SUBSTITUTE(B1,A1,""))
and copy down the column
 
Upvote 0
How will Excel, or indeed anyone, know what constitutes a city? Is there a definitive list somewhere it can be compared against? Or could we say for certain that the penultimate word, where it is part of the city, will be a limited number of words (East, West, Greater, etc).


If it relies on Excel making a judgement call then that might be tricky.


/AJ
 
Upvote 0
Adam, it wasn't a matter of excel figuring out what a city name is or isn't. The text in column B was exactly the same as the text in column A up until the start of the city name. So all I needed was the text from column B that was different then column A. Special's formula above worked great to accomplish this.
 
Upvote 0
Bfish,

How about something like this?


Excel 2007
ABC
1100 Division Street100 Division Street AnsoniaAnsonia
21135 Famington Avenue1135 Famington Avenue BerlinBerlin
3313 Cottage Grove Road313 Cottage Grove Road BloomfieldBloomfield
411 East High St.11 East High St. East HamptonEast Hampton
5
Sheet1
Cell Formulas
RangeFormula
C1=RIGHT(B1,LEN(B1)-LEN(A1)-1)


The formula in cell C1, copied down.
 
Upvote 0
Bfish,

How about something like this?

Excel 2007
ABC
100 Division Street100 Division Street AnsoniaAnsonia
1135 Famington Avenue1135 Famington Avenue BerlinBerlin
313 Cottage Grove Road313 Cottage Grove Road BloomfieldBloomfield
11 East High St.11 East High St. East HamptonEast Hampton

<colgroup><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #E0E0F0"]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: #E0E0F0"]C1[/TH]
[TD="align: left"]=RIGHT(B1,LEN(B1)-LEN(A1)-1)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



The formula in cell C1, copied down.


That looks like it would work as well Hiker
 
Upvote 0
Bfish,

Thanks for the feedback.

You are very welcome. Glad I could help.

And, come back anytime.
 
Upvote 0

Forum statistics

Threads
1,224,803
Messages
6,181,055
Members
453,014
Latest member
Chris258

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top