View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default How can I do a one to many merge in Excel?

Try using MS Query:

With your lists in 2 named ranges, with column headings.
I used rngValList1 for the first list and rngValList2 for the second

List
100
200
300

List
101
102
103

Make sure the file is saved so Excel can find it, then:
1)DataImport External DataNew Database Query
Databases: Excel Files


Browse to the file, pick the data ranges to import.
(in my case the file is called Lists)
---Accept defaults until the next step.

At The last screen select the View data/Edit The Query option.

Click the [SQL] button

Since you'll only have 2 lists, each containing one field, combine those 2
fields with an ampersand (&) and set the new field name.

Example:
SELECT
rngValList1.List&rngValList2.List as Combo
FROM
`C:\ExcelQueries\Lists`.rngValList1 rngValList1,
`C:\ExcelQueries\Lists`.rngValList2 rngValList2

When you click "Return data to Excel" you should get the following:
Combo
100101
200101
300101
100102
200102
300102
100103
200103
300103

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"AL" wrote:

Hi, I am trying to merge two sets of data into one using a one to many merge,
for example:
In column A, I have In column B, I have
100 101
200 102
300 103

my results column will look like:
100101
100102
100103
200101
200102
200103
300101
300102
300103

Any help would be appreciated.

AL