How to convert a crosstab table (2-dimensional table) to list in Excel?
Converting a crosstab table (two-dimensional table) to a list table (one-dimensional table) in Excel can be necessary for various data analysis tasks. If you have a table with both row and column headings and need to simplify it into a flat list, there are effective methods to achieve this transformation. This guide will demonstrate how to quickly and easily convert your crosstab table into a more manageable list format in Excel.
- Convert cross table to list in Excel with VBA
- Convert cross table to list in Excel with Kutools for Excel
![]() | ![]() | |
Cross table (with row headings and column headings) | A list table (one-dimensional table) |
Convert cross table to list in Excel with VBA
The following VBA macro can help you quickly convert all cross tables in active worksheets to flat lists.
Step 1: Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.
Step 2: Click Insert > Module, and paste the following macro in the Module Window.
The VBA on transpose crosstab table to list:
Sub ConvertTableToList()
'Updated by Extendoffice 2024/07/15
Const TEST_COLUMN As String = "A"
Dim i As Long, j As Long
Dim iLastRow As Long
Dim iLastCol As Long
Application.ScreenUpdating = False
With ActiveSheet
iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
iLastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
For j = iLastCol To 3 Step -1
.Rows(i + 1).Insert
.Cells(i + 1, 2).Value = .Cells(i, j).Value
.Cells(i, j).Value = ""
Next j
Next i
.Rows(1).Delete
End With
Application.ScreenUpdating = True
End Sub
Step 3: Click the F5 key to run this macro.
Then you will see the converted list showing as the following screenshot:
- This VBA macro loses some data from the original table, such as headers, or others. In this case, the headers (Name, Grade, and Class) are lost.
- You can change As String = "A", to meet your need. For example, if the cross table is stated in Column E, you should instead "E" instead of "A".
- And if there are other data in the worksheet, sometimes the data in the list will be wrong after converting a cross table.
Convert cross tables to lists in Excel with Kutools for Excel
If you have Kutools for Excel installed, you can use its Transpose Table Dimensions tool to convert cross tables to flat lists quickly.
Step 1: Select the table which you will convert to a list.
Step 2: Click the Kutools >Range > Transpose Table Dimension. See the following screenshot:
Step 3: In the Transpose Table Dimensions dialog box, check the Cross table to list option, and select the Results range by clicking the button.
Step 4: Click the OK button.
Then you will see the original table is converted into a flat list as following screenshot:
Transpose Table Dimensions also can convert the list to a crosstab table. For more information, please go to Transpose Table Dimensions.
Relative articles:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!
![Screen Shot of Excel (with Office Tab installed)](http://cdn.extendoffice.com/images/stories/kte-module/officetab-bottom-02.gif)