Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to convert matrix style table to three columns in Excel?

Supposing you have a matrix-style table which contains column headings and row headings, and now you would like to convert this style table to three columns table, it also called list table as following screenshot shown, do you have any good ways to solve this problem in Excel?

Convert matrix style table to list with PivotTable

Convert matrix style table to list with VBA code

Convert matrix style table to list with Kutools for Excel

doc convert matrix to list 1



In Excel, there isn’t a direct feature for us to convert the matrix style table to three columns table, but, if you are familiar with PivotTable, it may do you a favor. Please do with the following steps:

1. Activate your worksheet which you want to use, then holding Alt + D, and then press P in the keyboard, in the popped out PivotTable and PivotChart Wizard dialog, select Multiple consolidation ranges under the Where is the data that you want to analyze section, and then choose PivotTable under the What kind of report do you want to create section, see screenshot:

doc convert matrix to list 2

2. Then click Next button, in the Step 2a of 3 wizard, select the I will create the page fields option, see screenshot:

doc convert matrix to list 3

3. Go on clicking Next button, in the Step 2b of 3 wizard, click doc convert matrix to list 5 button to select the data range that you want to convert, and then click Add button to add the data range to the All ranges list box, see screenshot:

doc convert matrix to list 4

4. And click Next button, in Step 3 of 3 wizard, select a location for the pivot table as you want.

doc convert matrix to list 6

5. Then click Finish button, a pivot table has been created at once, see screenshot:

doc convert matrix to list 7

6. In the pivot table, double click intersecting cell of the Grand Total, in this case, I will double click the cell F22, and it will generate a three columns table as following screenshot shown:

doc convert matrix to list 8

7. And finally, you can convert the table format to the normal range by selecting the table and then choose Table > Convert to Range from the context menu, see screenshot:

doc convert matrix to list 9


If you don’t like the first method, the following VBA code also can help you.

1. Press Alt + F11 to display the Microsoft Visual Basic for Applications window.

2. In the window, click Insert > Module to show a new module window, then copy and paste the following VBA code into the module window.

VBA code: Convert matrix style table to list

Sub ConvertTable()
'Update 20150512
Dim Rng As Range
Dim cRng As Range
Dim rRng As Range
Dim xOutRng As Range
xTitleId = "KutoolsforExcel"
Set cRng = Application.InputBox("Select your Column labels", xTitleId, Type:=8)
Set rRng = Application.InputBox("Select Your Row Labels", xTitleId, Type:=8)
Set Rng = Application.InputBox("Select your data", xTitleId, Type:=8)
Set outRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set xWs = Rng.Worksheet
k = 1
xColumns = rRng.Column
xRow = cRng.Row
For i = Rng.Rows(1).Row To Rng.Rows(1).Row + Rng.Rows.Count - 1
    For j = Rng.Columns(1).Column To Rng.Columns(1).Column + Rng.Columns.Count - 1
        outRng.Cells(k, 1) = xWs.Cells(i, xColumns)
        outRng.Cells(k, 2) = xWs.Cells(xRow, j)
        outRng.Cells(k, 3) = xWs.Cells(i, j)
        k = k + 1
    Next j
Next i
End Sub

3. Then press F5 key to run this code, and a prompt box pops out to let you select the column labels of the data, see screenshot:

doc convert matrix to list 10

4. And then click OK button, in the next prompt box, select the row labels, see screenshot:

doc convert matrix to list 11

5. Go on clicking OK, then select the data range excluding the column and row headings in the prompt box, see screenshot:

doc convert matrix to list 12

6. And then click OK, in this dialog box, please select a cell where you want to locate the result. See screenshot:

doc convert matrix to list 13

7. At last, click OK, and you will get a three columns table at once.


Both of the above methods are somewhat troublesome, here, I will introduce you an easy way -- Kutools for Excel, with its Transpose Table Dimensions feature, you can quickly convert betwwen a matrix of cells and a list table.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days

After installing Kutools for Excel, please do as following steps:

1. Click Kutools > Range > Transpose Table Dimensions, see screenshot:

doc convert matrix to list 14

2. In the Transpose Table Dimensions dialog box:

(1.) Choose Cross table to list option under Transpose type.

(2.) And then click doc convert matrix to list 5 button under Source range to select the data range that you want to convert.

(3.) Then click doc convert matrix to list 5 button under Results range to select a cell where you want to put the result.

doc convert matrix to list 15

3. And then click OK button, and you will get the following result which including the original cell formatting:

doc convert matrix to list 16

With this utility, you also convert flat list table to 2-dimensional cross table.

To know more about this Transpose Table Dimensions feature.

Download and free trial Kutools for Excel Now !


Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Mike · 1 years ago
    Thanks, this was exactly what I was looking for. Awesome:)
  • To post as a guest, your comment is unpublished.
    shahrokh · 2 years ago
    what if i have 4 or more column?