Convert multiple lines of text record into table

J

jrjinfo

2-1-08

Hi,

I received a WORD 2003 document consisting of 500 + names, address and phone
numbers typed as:

First MI Last → Home: 213-456-7890 (return)
123 Main St → Work: 213-789-0456 (return)
City, ST ZIP → Email: me@mydomain ¶


How do I parse the three lines of information into one line per record in
the following format:

First MI Last Street Address City ST ZIP Home # Work # Email

so I can convert the text to a table and then into a usable data file.


Thanks so much for your help.

Joanne
 
J

Jay Freedman

2-1-08

Hi,

I received a WORD 2003 document consisting of 500 + names, address and phone
numbers typed as:

First MI Last ? Home: 213-456-7890 (return)
123 Main St ? Work: 213-789-0456 (return)
City, ST ZIP ? Email: me@mydomain ¶


How do I parse the three lines of information into one line per record in
the following format:

First MI Last Street Address City ST ZIP Home # Work # Email

so I can convert the text to a table and then into a usable data file.


Thanks so much for your help.

Joanne

This is essentially the same problem as converting an existing label document
into a mail merge data source. Read
http://www.gmayor.com/convert_labels_into_mail_merge.htm and start with the part
of the procedure after the "Convert Table To Text" dialog. It explains how to
use the Replace function to make each piece of information into a separate
paragraph, with a unique marker at the end of each record.

In your case, you want to move the Home, Work, and Email pieces after the City
ST ZIP piece. That could be done with a wildcard replacement
(http://www.gmayor.com/replace_using_wildcards.htm) or with a macro. This could
get complicated if some of the records don't have some of these pieces filled
in, or if some of the street addresses are more than one line.
 
D

Doug Robbins - Word MVP

Answered your identical question in the mailmerge fields newsgroup. Please
do not post the same question separately to multiple newsgroups.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Suzanne S. Barnhill

If by "return" you mean a line break (as opposed to the paragraph break
represented by ¶), then this would be fairly simple. Replace the line breaks
with tabs, then Table | Convert | Text to Table, separating at tabs and
making sure that the resulting table has six columns. Rearrange the columns
into the desired order, then use something on the order of
http://word.mvps.org/FAQs/TblsFldsFms/SplitFirstNameLastName.htm to split
the Name and City/State/ZIP columns into separate columns. Also, it's quite
possible you could replace the spaces between city and state, state and ZIP
with tabs before converting to a table by using wildcards (assuming all
states are two-letter abbreviations and all ZIPs have the same number of
digits).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top