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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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
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

<colgroup><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
C1=RIGHT(B1,LEN(B1)-LEN(A1)-1)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



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,214,834
Messages
6,121,876
Members
449,056
Latest member
ruhulaminappu

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