OK forum, I can't figure out how to ask this question correctly in the search or Google to get a satisfactory answer. I am sure y'all will figure it out.
I have a text thread that starts out in a cell like this (pulled from the source like this, no way to change):
G1 Address
[TABLE="width: 394"]
<tbody>[TR]
[TD="width: 394"]G2 4208 Bluffs Lane Durham, North Carolina 27712
[/TD]
[/TR]
</tbody>[/TABLE]
I used some other people's formula knowledge and existing data sets to chop that up into its separate parts:
[TABLE="width: 558"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Address[/TD]
[TD]City[/TD]
[TD]State[/TD]
[TD]Zip[/TD]
[/TR]
[TR]
[TD]4208 Bluffs Lane[/TD]
[TD]Durham[/TD]
[TD]NC[/TD]
[TD]27712[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 558"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The problem comes when the city is a two word city.
[TABLE="width: 558"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Address[/TD]
[TD]City[/TD]
[TD]State[/TD]
[TD]Zip[/TD]
[/TR]
[TR]
[TD]1912 Foxcroft Drive Mount[/TD]
[TD]Airy[/TD]
[TD]NC[/TD]
[TD]27030[/TD]
[/TR]
</tbody>[/TABLE]
Then the first word of the city name is not being pulled because of the original function which only looks to pull the rightmost word (plus the comma that comes from the original data, shortened in a subsequent cell)
=RIGHT(I86,LEN(I86)-FIND("^^",SUBSTITUTE(I86," ","^^",LEN(I86)-LEN(SUBSTITUTE(I86," ","")))))
I86 contents are:
[TABLE="width: 394"]
<tbody>[TR]
[TD="width: 394"]1912 Foxcroft Drive Mount Airy,
[/TD]
[/TR]
</tbody>[/TABLE]
I'm sure improvements can be made on that formula but it does the trick most of the time. I only end up with a few entries that still have the city tacked on the end of the street address. For those few, the final city name is in column L. What I would like is an IF function that checks against a list of known two city names (like "Mount Airy" in the example) and either substitutes the two words for the one or - preferrably - goes back and trims the other words out of the new K column (I column minus the RIGHT second or only city name).
Suggestions for best way to do this? I coudn't figure it out using INDEX MATCH or like functions...
TIA
I have a text thread that starts out in a cell like this (pulled from the source like this, no way to change):
G1 Address
[TABLE="width: 394"]
<tbody>[TR]
[TD="width: 394"]G2 4208 Bluffs Lane Durham, North Carolina 27712
[/TD]
[/TR]
</tbody>[/TABLE]
I used some other people's formula knowledge and existing data sets to chop that up into its separate parts:
[TABLE="width: 558"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Address[/TD]
[TD]City[/TD]
[TD]State[/TD]
[TD]Zip[/TD]
[/TR]
[TR]
[TD]4208 Bluffs Lane[/TD]
[TD]Durham[/TD]
[TD]NC[/TD]
[TD]27712[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 558"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The problem comes when the city is a two word city.
[TABLE="width: 558"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Address[/TD]
[TD]City[/TD]
[TD]State[/TD]
[TD]Zip[/TD]
[/TR]
[TR]
[TD]1912 Foxcroft Drive Mount[/TD]
[TD]Airy[/TD]
[TD]NC[/TD]
[TD]27030[/TD]
[/TR]
</tbody>[/TABLE]
Then the first word of the city name is not being pulled because of the original function which only looks to pull the rightmost word (plus the comma that comes from the original data, shortened in a subsequent cell)
=RIGHT(I86,LEN(I86)-FIND("^^",SUBSTITUTE(I86," ","^^",LEN(I86)-LEN(SUBSTITUTE(I86," ","")))))
I86 contents are:
[TABLE="width: 394"]
<tbody>[TR]
[TD="width: 394"]1912 Foxcroft Drive Mount Airy,
[/TD]
[/TR]
</tbody>[/TABLE]
I'm sure improvements can be made on that formula but it does the trick most of the time. I only end up with a few entries that still have the city tacked on the end of the street address. For those few, the final city name is in column L. What I would like is an IF function that checks against a list of known two city names (like "Mount Airy" in the example) and either substitutes the two words for the one or - preferrably - goes back and trims the other words out of the new K column (I column minus the RIGHT second or only city name).
Suggestions for best way to do this? I coudn't figure it out using INDEX MATCH or like functions...
TIA