Create New Spreadsheet of data from many Excel workbooks

1

0

In retrospect, this is an issue of data-collection, but I want to see if there is an easy way to do it without doing each file.

I have about 350 separate Excel workbooks. Each workbook has a bit of information pertaining to one individual.

What I want to do is create a simply spreadsheet of everyone with the necessary data, so it is then usable.

To give you an idea. A1 lists "Name" with B1 having the person's name. A2 has "Last 4 SSN" and B2 has the 4 digits.

Then A3 has the word "Year", then A4 "2014 est", A5 - "2013", A6 - "2012, etc, to 2009.

Then in Row 3 from B to N there are different pieces of information.

What I want to do, if possible, is have a master spreadsheet with columns of name, last 4 ssn, and then years for each of the pieces of data. ie. 2013-Interest

Is this even possible?I hope this makes sense.

D bell

Posted 2014-07-31T18:36:00.660

Reputation: 11

What have you researched or tried so far? – CharlieRB – 2014-07-31T19:04:47.290

I would think it is possible, as manually doing this would take a long time, but you could do it. Have you tried anything to date so far? – Mr. Hargrove – 2014-07-31T19:05:04.483

1Are you looking for a one-time consolidation, or do you want to continue updating the individual sheets and have those updates pushed to (or pulled by) the master? – Iszi – 2014-07-31T19:14:04.280

Take a look about consolidating data from multiple worksheets; this could give you a good understanding. http://office.microsoft.com/en-us/excel-help/consolidate-data-from-multiple-worksheets-in-a-single-worksheet-HP010342300.aspx?CTT=1

– Mr. Hargrove – 2014-07-31T19:35:16.323

Answers

1

I would use the Power Query Add-In for this. You can start a Query from an Excel table. If you spreadsheets are in separate files it has a great function to import all the files in a Windows Folder in a single step and append all their data together (assuming the file columns are consistent). If they are multiple sheets in a single file then you will need multiple Queries, which you can combine together using the Append command.

http://office.microsoft.com/en-au/excel-help/append-queries-HA104149760.aspx?CTT=5&origin=HA103993872

There is also an Unpivot command to transform data stored in multiple columns into multiple rows - maybe that would solve your multi-Year challenge.

Mike Honey

Posted 2014-07-31T18:36:00.660

Reputation: 2 119

0

You can merge the data from all the workbooks in a folder by using VBA. If you are familiar with VBA, you can add the following code to a workbook and run it. It will create a new workbook with all the data combined from the files in the folder you designate in the FolderPath.

Note: As a safeguard, it would be a good idea to make a copy of all files into a separate folder while you run this code.

Sub MergeAllWorkbooks()
    Dim SummarySheet As Worksheet
    Dim FolderPath As String
    Dim NRow As Long
    Dim FileName As String
    Dim WorkBk As Workbook
    Dim SourceRange As Range
    Dim DestRange As Range

    ' Create a new workbook and set a variable to the first sheet. 
    Set SummarySheet = Workbooks.Add(xlWBATWorksheet).Worksheets(1)

    ' Modify this folder path to point to the files you want to use.
    FolderPath = "C:\Users\Peter\invoices\"

    ' NRow keeps track of where to insert new rows in the destination workbook.
    NRow = 1

    ' Call Dir the first time, pointing it to all Excel files in the folder path.
    FileName = Dir(FolderPath & "*.xl*")

    ' Loop until Dir returns an empty string.
    Do While FileName <> ""
        ' Open a workbook in the folder
        Set WorkBk = Workbooks.Open(FolderPath & FileName)

        ' Set the cell in column A to be the file name.
        SummarySheet.Range("A" & NRow).Value = FileName

        ' Set the source range to be A9 through C9.
        ' Modify this range for your workbooks. 
        ' It can span multiple rows.
        Set SourceRange = WorkBk.Worksheets(1).Range("A9:C9")

        ' Set the destination range to start at column B and 
        ' be the same size as the source range.
        Set DestRange = SummarySheet.Range("B" & NRow)
        Set DestRange = DestRange.Resize(SourceRange.Rows.Count, _
           SourceRange.Columns.Count)

        ' Copy over the values from the source to the destination.
        DestRange.Value = SourceRange.Value

        ' Increase NRow so that we know where to copy data next.
        NRow = NRow + DestRange.Rows.Count

        ' Close the source workbook without saving changes.
        WorkBk.Close savechanges:=False

        ' Use Dir to get the next file name.
        FileName = Dir()
    Loop

    ' Call AutoFit on the destination sheet so that all 
    ' data is readable.
    SummarySheet.Columns.AutoFit
End Sub

Read the notes carefully to modify the areas specific to your needs. Here is the source of this code if you need to refer to it - Merging Data from Multiple Workbooks into a Summary Workbook in Excel 2010.

CharlieRB

Posted 2014-07-31T18:36:00.660

Reputation: 21 303