+ Reply to Thread
Results 1 to 5 of 5

Automatically Copy Data From Multiple Sheets To A Master

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    16

    Automatically Copy Data From Multiple Sheets To A Master

    Hi,

    I've been playing around with Data Consolidation for a while now and can't get it to do what I want. I'm thinking that's probably the wrong way to go.

    I've uploaded a sample of what I'm looking to do. Multiple people will be inputting data into different sheets but will all have the same format. What I'd like is the Master sheet to pull all the data from each sheet to show it all as one.

    There will be a variety of data (numbers, words, drop downs) and the Master will be identical in terms of layout.

    Some sheets will have more entries than others so if possible, only want to copy over the rows with values in them rather than the blanks as well. There will also be an unlimited number of potential rows and they will change daily.

    Any help much appreciated.

    May the force be with you! ;-)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Automatically Copy Data From Multiple Sheets To A Master

    how many (maximum?) sheets?.

    I suspect VBA is the way to go as consolidating data from multiple sheets is very difficult to do with formulae.

  3. #3
    Registered User
    Join Date
    10-14-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Automatically Copy Data From Multiple Sheets To A Master

    Hi, thanks for replying.

    I'd say the maximum will probably be ten. As for how many lines of data? Maximum would be 100 I'd say. Most likely around 20-40 rows per sheet though.

    Unfortunately I wouldn't even know where to start with VBA! :-/

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: Automatically Copy Data From Multiple Sheets To A Master

    This proposed solution uses a lot of helper columns, which may be hidden for aesthetic purposes, because as John states consolidating data from multiple sheets is difficult. This is only an example of how you might go about consolidating using the data in the sample file. The first set of formulas sets up tables that duplicate those found on the two sheets to be consolidated using formulas like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Next I made a single column (N) of the data using the array entered formula*:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The next helper column (P) takes out blanks and zero values using the array entered formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Finally the table in columns A:C is populated using the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    *Array entered formulas are activated by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,726

    Re: Automatically Copy Data From Multiple Sheets To A Master

    I've attached a file showing how you can achieve this using a few formulae.

    First of all, I have inserted a new column A in all the subsidiary sheets and put this formula in A2:

    =IF(B2="","-",MAX(A$1:A1)+1)

    This can then be copied down as far as you like to accommodate more data being added (I've copied to row 20 in the example file, as can be seen by the hyphens, which help to show where the formula is active). This produces a unique sequential number against each record, and I've put some extra data in with blank rows to show that it is still effective in that situation. On the first of the subsidiary sheets (Anakin) I have put zero in cell A1 (coloured yellow), which is the starting point of the sequence of numbers, but in the next sheet I have used this formula in A1:

    =MAX(Anakin!A:A)

    which gets the highest number in the previous sheet, and so this is the starting point for the second sheet. Thus the numbers in the second sheet carry on from the first, and if you had a third sheet then cell A1 should contain this formula:

    =MAX('Obi Wan'!A:A)

    so then the numbers would continue into that sheet. I've coloured the cells in these helper columns blue, and if the formulae have been copied down far enough then the column can be hidden so that the sheet will look the same as before.

    In the Master sheet I have inserted two new columns A and B to act as helpers, and I've also set up a small table in columns M and N, where I have put the sheet names in M2 down, and this formula in N2:

    =MAX(INDIRECT("'"&M2&"'!A:A"))

    which when copied down shows the cumulative number of records in those sheets. It is important that cell N1 contains zero. If you have more sheets you just need to add the name(s) to the bottom of the list in column M, and copy the formula in column N down further, as appropriate.

    Cell A2 in the Master sheet contains this formula:

    =IF(ROWS($1:1)>MAX(N:N),"",INDEX(M:M,MATCH(ROWS($1:1)-1,N:N)+1))

    and when this is copied down it returns the sheet name where the record for that number should be found. The formula in B2, i.e.:

    =IF(A2="","",MATCH(ROWS($1:1),INDIRECT("'"&A2&"'!a:a"),0))

    returns the row number in the appropriate sheet where the record can be found. Thus it is quite easy then to retrieve the Name field for the appropriate record, using the formula in cell C3:

    =IF($A2="","",INDEX(INDIRECT("'"&$A2&"'!b:b"),$B2))

    This formula can be copied across, but the b:b part will need to be changed to c:c, then d:d and so on to get the data for the other fields. Finally, all those formulae in A2:E2 can be copied down as far as you need them, in order to accommodate the amount of data that you have - I've just copied down to row 20 in the example file.

    Notice that the blank rows in the subsidiary sheets have disappeared, so all the data is neatly bunched up. Columns A and B can be hidden if you don't want to see them.

    Hope this helps.

    Pete
    Attached Files Attached Files

+ 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. [HELP] VBA code to copy filtered data from multiple excel sheets into one master sheet
    By daaniyal57 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2016, 01:44 PM
  2. Copy and Paste data automatically from master sheet to other sheets
    By wschleis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2014, 04:29 PM
  3. [SOLVED] Automatically Copy Data from Multiple Sheets to a Master Sheet
    By Ryan_Brandt in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-10-2014, 06:45 AM
  4. Replies: 2
    Last Post: 07-17-2014, 09:46 PM
  5. [SOLVED] Copy Data From Master Sheet to Multiple Sheets
    By dmmr in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-06-2013, 11:28 AM
  6. [SOLVED] Copy Data to Master List from Multiple Sheets
    By Jrub in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2012, 12:59 PM
  7. [SOLVED] Macro to copy data from multiple sheets to one (new) master sheet
    By nhtodd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2012, 02:30 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