I would like to create a PivotTable out of "hierarchical" data contained in an Excel 2010 worksheet. The data is hierarchical in the sense of a parent/child relationship in a database where, effectively, one "parent" row may have many "child" rows.
I have a large worksheet I compiled as part of a research project. The rows in the worksheet represent legal judgments (cases). In each case, there are one or more legal issues. Part of the project involved classifying the issues in the worksheet. For simplicity, the sheet has three columns for issues, "Issue 1", "Issue 2", "Issue 3".
Here's a simplified example of the worksheet. Note that I have simplified it and there are many other columns.
A B C ... F G H I ...
CASEID APPEAL FROM ISSUE1 ISSUE2 ISSUE3
C01 Conviction Evidence-admissibility
C02 Conviction Credibility Fresh evidence
C03 Acquittal Credibility Evidence-misapprehension
C04 Conviction Fairness Abuse of process Delay
C05 Sentence Credit for time served
As you can see, it would be nice to be able to answer questions such as: What are the most prevalent issues on appeals from convictions?
Conceptually, the data I have shown above really has a form of parent/child relationship. Imagine a "Case" table and an "Issue" table where there is a 1:N relationship between the two tables.
Is there a way to get this data into a PivotTable so I can answer questions such as the one I suggested above? I am able to "massage" the data programmatically, but I would prefer to avoid something as crude as creating a new worksheet and flattening it by duplicating rows. In other words, I would rather not transform the above worksheet into this:
A B C ... F G ...
CASEID APPEAL FROM ISSUE
C01 Conviction Evidence-admissibility
C02 Conviction Credibility
C02 Conviction Fresh evidence
C03 Acquittal Credibility
C03 Acquittal Evidence-misapprehension
C04 Conviction Fairness
C04 Conviction Abuse of process
C04 Conviction Delay
C05 Sentence Credit for time served
Best Answer
I would download the Power Query add-in
http://office.microsoft.com/en-us/excel/download-microsoft-power-query-for-excel-FX104018616.aspx
... and use the Append function:
http://office.microsoft.com/en-001/excel-help/append-queries-HA104149760.aspx?CTT=5&origin=HA103993872
Power Query was recently released - it works like recording a macro, but focussed on importing data into Excel and mashing up tables of data. You design "Query" objects which are reusable and can be edited in script form.
The Append function in Power Query can append rows from one table beneath another in a single operation.