Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 07-03-2014, 08:38 AM
kjxavier kjxavier is offline Find and Replace Windows XP Find and Replace Office 2007
Advanced Beginner
Find and Replace
 
Join Date: Jul 2011
Posts: 39
kjxavier is on a distinguished road
Thumbs up Find and Replace

Hi! Am using MS Office 2007,

I have a list of Names followed by the City and State, I need to separate the the Names, City and States

Eg:



Mr.Thomas B Fernan dez New York.NY
Mr.Bar ry K Olivia Houston.TX
Ms.Dor othy D Hawell Rocky Mount.NC
Mr.Tho mas L Morg Deerpark.NY
M rs.Jennifer D Lebl anca Carlisle.PA


Expected Result:

Mr.Thomas B Fernandez <tab>New York.NY
Mr.Barry K Olivia <tab>Houston.TX
Ms.Dorothy D Hawell <tab>Rocky Mount.NC
Mr.Thomas L Morg <tab>Deerpark.NY
Mrs.Jennifer D Leblanca <tab>Carlisle.PA

Suggestions:

1. Take off all <SPACE> continued by small letters (Fernan dez - Fernandez; Bar ry - Barry; Dor othy - Dorothy; M rs. - Mrs.; Lebl anca - Leblanca, so on......)

2. Names always have the same format. i.e.: SALUTATION.<FIRSTNAME>SPACE<Initial of MIDDLE NAME>SPACE<LAST NAME>

3. Place a <TAB> before the 5th Capital Letter, i.e. before city 'New York' in first case.

which can give the above mentioned result.


Its really urgent for me! Please help me out! (pls mention if it can be better done with MS Excel)

Thank you in advance! your early reply is highly appreciated.
  #2  
Old 07-04-2014, 11:18 PM
macropod's Avatar
macropod macropod is offline Find and Replace Windows 7 32bit Find and Replace Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If the goal is simply to insert a tab before the assumed city in the sample data, that could be accomplished with a wildcard Find/Replace, where:
Find = ([A-Z]*[A-Z]*[A-Z]*[A-Z]*)([A-Z][!^13]@^13)
Replace = \1^t\2
And, if cleaning up the split words is required, that could be accomplished with just:
Find = ( )([a-z])
Replace = \2
Note that this would also fix the split words in the 2nd problem.

While the process offered works for the limited examples supplied, there are many other situations in which the same process will fail. For example:

Mr.Albert Van der Meer New York.NY
Mrs.Ann M St John Rhode Is.NY
where 'Van der Meer' or 'St John' is the surname. The process messes up both surnames, joining the 'Van der' together as one word when it should remain two words and putting the tab between 'St' and 'John' in the 'St John' surname! The process also won't work if you have only one given name or initial for the person. I'm sure I could find plenty of other situations where the result would be incorrect, too.

The process only appears to work - because the sample data are not sufficiently comprehensive. To do the job properly requires a lookup table of cities and states.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Closed Thread

Tags
find and replace, formating



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace Find what box in Find and replace limits the length of a search term Hoxton118 Word VBA 7 06-10-2014 05:05 AM
Find/Find and Replace Loop Tango Mike Word 3 04-20-2014 02:47 PM
Find and Replace Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
Find and Replace Is there a way to use "find/replace" to find italics words? slayda Word 3 09-14-2011 02:16 PM
Find and Replace Help with find and replace or query and replace shabbaranks Excel 4 03-19-2011 08:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft