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!


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
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.
    cmb · 4 months ago
    Thanks alot for this useful tool
  • To post as a guest, your comment is unpublished.
    Mike · 2 years ago
    Thanks, this was exactly what I was looking for. Awesome:)
  • To post as a guest, your comment is unpublished.
    shahrokh · 3 years ago
    what if i have 4 or more column?