+ Reply to Thread
Results 1 to 10 of 10

Combine data from multiple worksheets into one.

  1. #1
    Registered User
    Join Date
    03-11-2014
    Location
    Ottawa
    MS-Off Ver
    Excel 2013
    Posts
    8

    Combine data from multiple worksheets into one.

    Every month several employees fill out a form that contain all their expenses for the month.

    Expense Detail - Category - Expense Amount

    I want to be able to take each form and import it into a master file.

    The file would contain a master worksheet that would contain all the tables for each expense report merged into one table.

    If John's expense sheet contained 10 expenses (rows of data)
    and Mary's contained 17
    and so on..

    I want mastersheet to list John's expenses; 10 rows (a2-a12). And then list Mary's expenses starting where John left off (a13 - a30)

    I want to be able to analyze the data afterwords, but i'm currently having trouble compiling it in one sheet automatically.

    This can be done via copy/paste, but i want it to be automatic.

    That means if i were to add something to Mary's list, it would automatically compile in mastersheet.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine data from multiple worksheets into one.

    Hi,

    If all the expense sheets are the same layout then you could have a macro that opened each workbook in turn and imported the data into a master table. However before going to that consider whether there might be a more pragmatic solution, particularly if you have a relatively small number of users and you can be reasonably sure that they never have say more than 50 lines of claim per month

    In the Master workbook create a master table and then simply link consecutive blocks of 50 rows to each of the users workbooks. So for instance in the Master table assuming field headings are in row 1, in row A2 add the formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy this to A2:H51 (or whatever columns are relevant).
    Then in A52 enter the same formula but referencing say Mary's workbook, and copy to A52:H101

    etc.

    Create individual workbooks before any expenses are added and simply send them out each month and ask the users to use the new workbook and rename their last month workbook if necessary.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Combine data from multiple worksheets into one.

    Hi tlgdesign,

    Attached is the macro use to combine data of multiple workbooks into single worksheet.

    CombineWorkbooks.xls

    Hope this helps you.

    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  4. #4
    Registered User
    Join Date
    03-11-2014
    Location
    Ottawa
    MS-Off Ver
    Excel 2013
    Posts
    8

    Re: Combine data from multiple worksheets into one.

    Hi Paresh, Tks for the quick reply.

    its a little more complicated than that.

    I will explain in the next post

  5. #5
    Registered User
    Join Date
    03-11-2014
    Location
    Ottawa
    MS-Off Ver
    Excel 2013
    Posts
    8

    Re: Combine data from multiple worksheets into one.

    Hey Richard,

    I'm sorry but my last post wasn't very clear. I'll try to explain it better.

    Every month I get an email from all employees that have expenses to claim.
    I also get emails from the receptionists, who are in charge of the petty cash boxes.

    As an example receptionist-a would send me an excel file at the end of every month that looks like this

    feb14pc.JPG

    Upon receiving it, I would import the sheet it into Receptionist-a.xls

    Reception-a.xls would have - to date - 5 sheets (one for every month) ; Jan14 PC, Feb14 PC... May14 PC

    every sheet is the same layout

    Receptionist b would do the same (receptionist-b.xls)
    Any employees with expenses to claim would do the same (john.xls, sara.xls, etc.)

    So, as of now:
    1. I have 7 workbooks. Each workbook belongs to an employee
    2. Each book contains sheets that pertain to a specific month in a specified format. for example, John.xls contains Feb14 John, Mar14 John etc..
    3. Column D of each sheet contains a category of expense (as seen in above image). ie. Transportation, Food, Maintenance, etc.

    I wish to create a master book. This book will contain a sheet for each category. For example it will have 3 sheets; transportation, maintenance, & food:

    The first sheet [transportation] will scan receptionist-a.xls, the first sheet [Jan14 PC].

    This is the part i am having trouble with:

    If b2 = "transportation" on sheet [Jan14 PC] then it will copy the entire row onto the first available row on sheet [transportation], on masterbook.xls.
    it will continue scanning until it completes the sheet.
    Next it will do the same for the next sheet [Feb14 PC] and next [Mar14 PC].. and so on until it completes the workbook.

    Once it is done scanning all sheets in the workbook, it will do the same for the next workbook until it completes all workbooks.

    Upon completion of scanning all transportation expenses and inputting them in the master workbook, it will move onto the next sheet [maintenance] and do the same, and then [food] until all are complete.

    The end result being all transportation related expenses claimed by all employees are gathered into one sheet [transportation].
    all maintenance related expenses from all employees are gathered into [maintenance] and so on.
    Basically, I get a breakdown of all expenses by category

    If I haven't explained it well enough, please let me know.

    If you think this is a lot harder than I am making it to be, or you don't have the time to explain what I need, then even pointing me in the right direction is well appreciated.

    looking forward,

  6. #6
    Registered User
    Join Date
    03-11-2014
    Location
    Ottawa
    MS-Off Ver
    Excel 2013
    Posts
    8

    Re: Combine data from multiple worksheets into one.

    Hi,

    Please see the file attached.

    receptionist-a.xlsx

    that is an example of a file submitted by an employee.

    there are several such workbooks.

    I want to have a master book, which will read column a (expense category) on each sheet of each workbook and copy the whole row (similar to sumif. However, i am looking not just for the sum, but the whole row to be copied) to the appropriate sheet (each category will represent a sheet on the masterbook).
    Last edited by tlgdesign; 06-07-2014 at 05:25 PM.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine data from multiple worksheets into one.

    Hi,

    It seems that the various workbooks are not all resident on a central server. Is that assumption correct?

    I think the approach I'd adopt is to save all the workbooks in the same folder then have a macro in the master workbook that opens each workbook in turn and copies the records from the relevant month into a single sheet, stacking each persons records underneath the previous set of records. As part of the copy process I'd populate two additional columns on every row with the month name and the persons name.

    This process will result in a database of records that can then be easily analysed and summarised by using a Pivot Table.

  8. #8
    Registered User
    Join Date
    03-11-2014
    Location
    Ottawa
    MS-Off Ver
    Excel 2013
    Posts
    8

    Re: Combine data from multiple worksheets into one.

    All the workbooks will be in one directory

    Is this macro already available or do I have to make it?

    Also is there a function similar to sumif, that, instead of just simply adding sum if a criteria is met, it will copy the entire row if criteria is met?

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Combine data from multiple worksheets into one.

    Please Login or Register  to view this content.
    To m knowledge there is not such a function in excel.

    This can be achieved using VBA.

    Advice:

    Please Login or Register  to view this content.
    It describe your problem better, for member who using the search tool.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine data from multiple worksheets into one.

    Hi,

    As Oeldere has commented a function can't DO anything, i.e. take any actions, it can merely return values for you. To filter data you will need VBA.
    Have you uploaded examples of the expense sheets, if not would you do so, and also explain what criteria you would want to use to filter and copy subsets of the individual workbooks to the master sheet.

+ 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. Replies: 2
    Last Post: 06-17-2014, 11:16 AM
  2. Need to combine data from multiple worksheets in multiple workbooks into 1 worksheet
    By ginric99 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2013, 07:58 AM
  3. How to automatically combine data from multiple worksheets into a master worksheet
    By BeardedLuminary in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-28-2013, 10:57 AM
  4. [SOLVED] Combine data from multiple worksheets into a new worksheet
    By sh3ll3tt3 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-08-2012, 08:08 AM
  5. Combine data from multiple worksheets into a new worksheet
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-17-2009, 12:29 AM

Tags for this Thread

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