- AML (14)
- Foundation (4)
- Personal Finance (21)
- Technology (22)
- 7 Dec 2009: Move securities to Roth Account
- 28 Nov 2009: Leverage Checksum to determine identical files
- 4 Oct 2009: CAMS Certification Preparation
- 30 Aug 2009: Section 311 etc. (ACAMS Notes)
- 24 Aug 2009: FATF Membership Points (ACAMS Notes)
- 22 Aug 2009: Internet Casinos and Prepaid Cards/E-Cash (ACAMS Notes)
- 5 Aug 2009: Spousal IRA
- 15 May 2009: Buying Call Options.
- 7 Jan 2009: Watchlist filtering white paper
- 31 Oct 2008: Autonumber in Microsof Excel (works after inserting rows)
Generating matrix using Microsoft Excel’s Pivot Tables
Often times there is a need to generate a matrix. For simplicity sake, let’s assume that you have a table containing Products and States in which they are sold. Microsoft Excel has a very efficient utility called pivot tables which one can leverage to generate the required matrix.
For example :
|
Product |
States |
|
P1 |
NC |
|
P1 |
PA |
|
P1 |
WA |
|
P2 |
NC |
|
P2 |
NY |
|
P3 |
MI |
|
P4 |
CA |
|
P4 |
AZ |
|
P4 |
NC |
|
P5 |
FL |
And if the desired output is :
|
Product |
AZ |
CA |
FL |
MI |
NC |
NY |
PA |
WA |
|
P1 |
|
|
|
|
1 |
|
1 |
1 |
|
P2 |
|
|
|
|
1 |
1 |
|
|
|
P3 |
|
|
|
1 |
|
|
|
|
|
P4 |
1 |
1 |
|
|
1 |
|
|
|
|
P5 |
|
|
1 |
|
|
|
|
|
Following are the steps to generate the desired output using Microsoft Excel’s Pivot tables
1. Go to Data –> PivotTable and Pivot Chart Report
2. On Pivot Table and Pivot Chart Wizard Step 1 of 3
2a. Select the Microsoft Office Excel List or database
2b. Select “Pivot Table” for the 2nd question.
2c. Click “Next.
3. Select range (where your data resides on the worksheet) and click next
4. Determine where you want to put this pivot table and click next
5. Click Finish
6. Drag and Drop the “Product” in “Drop Row Fields Here” area.
7. Drag and Drop the “States” in “Drop Column Fields Here” area.
8. Drag and Drop the “States” in “Drop Data Items Here” area.
9. Done!
If you have a product which is not being sold in any states and if you want to show it on the matrix, you can add a row to the product/states table. Set the value of state to . If you followed the above mentioned process all you will have to do is right click on the pivot table area and hit “Refresh Data”, your matrix will be updated in a split second!

26 Feb 2008 at 03:05
How to do the reverse of this thing??
26 Feb 2008 at 09:06
Thanks for the query but unfortunately I don’t know how to do that. If I find out I will post it on my blog.
Thanks for your time.
3 Mar 2008 at 16:39
Thank you, this is exactly what I was looking for, just one more question: is it possible to convert the 1’s to another symbol, such as x or checkmark?
Thanks;
11 Feb 2009 at 08:54
Wow! Really awesome post!
… Question: What version of excel did you use?
11 Feb 2009 at 09:24
Excel 2003