+ Reply to Thread
Results 1 to 2 of 2

Merge several workbooks with something like a query

  1. #1
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Göteborg
    MS-Off Ver
    2010
    Posts
    130

    Merge several workbooks with something like a query

    Last year I got helped from the user MickG with a macro that would make a unique list depending on the first column. Here is the thread; (http://www.excelforum.com/showthread.php?t=1164541).
    Now im trying to implement this in another of my projects but I have to change the code a bit. Or maybe there is a better way to solve my problem. First of all I have a excelfile with 21 columns (StartDoc) with data in a couple thousands of rows. Then there is another file with 3 columns with data where the first column is a match of a column in my StartDoc. In the same way there is a third file with two columns where the first is a match to another in my StartDoc. Maybe you see how this is working? In short terms I want to merge several excelfiles with each other since there is link to my StartDoc. I know its possible to do this in Microsoft Access with a query but I would like to exploit the possibility to do this in excel. Anyways I recently thought about maybe its possible to adjust the code below to my cause. I tried to adjust the code to the correct columns and is working but the problem is that the data is not unique in the same way as my previous problem. For example lets assume that one of my files is a phonelist where column 1 is a name and column 2 is a phonenumber. In my StartDoc I then have only the names but I need the phonenumbers from the other file. The problem with the code below is that it only accept one unique name but a name in my StartDoc can appear in hundreds of rows. Anyone got any ideas how I can work around this?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: Merge several workbooks with something like a query

    Take a look at this article: http://www.excelforum.com/showthread.php?t=1168850. You can read worksheets in via MS-Query. I would recommend importing three separate tables and then using VLOOKUP or Match / Index to populate the main table from the other tables.

    MS-Query returns data as Excel Tables, so any formulas you put in columns to the right of the returned data will be "remembered" when the data are refreshed. I suggest you go to Data -> Connections and in the properties for each connection, turn off Background Refresh.

    It may be possible to open all three workbooks in the same MS-Query. I've not tried it. The issue is that the query builder in MS-Query is poor - I generally advise people to develop the query elsewhere and copy the SQL to the command string.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA merge workbooks
    By Roadhouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2016, 06:15 AM
  2. [SOLVED] Merge All Workbooks
    By tejboyd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-18-2014, 05:25 AM
  3. [SOLVED] Merge All Workbooks
    By tejboyd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2014, 11:55 AM
  4. Merge two workbooks
    By parknflymtl in forum Excel General
    Replies: 2
    Last Post: 03-22-2011, 01:36 PM
  5. Mail Merge Query - Format of Merge Fields in Word
    By carlosbourn in forum Excel General
    Replies: 2
    Last Post: 11-10-2007, 07:11 AM
  6. merge workbooks
    By mg_sv_r in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-14-2006, 12:20 PM
  7. MS Query merge columns
    By mauddib in forum Excel General
    Replies: 1
    Last Post: 03-31-2005, 10:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1