Power Query Problems

How to Unpivot Cross-Tab Excel Data into Rows Without VBA

Camila MilosovichCamila Milosovich Nov 13, 2026 871 views

Question details

The user needs to reshape a cross-tab table where hours are spread across columns such as A Hours through D Hours into individual rows containing Date, Name, and Hours, without using VBA.

How to Unpivot Cross-Tab Excel Data into Rows Without VBA
Product
WPS Spreadsheet (Power Query)
Device & OS
not provided
Scenario
The user has a crosstab source table with Date and Name identifier columns and multiple hour columns. They want a normalized table with one row per Date-Name-hour combination for reporting or further analysis.
Observed behavior
The current table stores hour values in multiple columns, and zero or blank hour values should be excluded from the final unpivoted result.
Before you start

Open the workbook containing the cross-tab table and confirm that the source range has unique headers for Date, Name, A Hours, B Hours, C Hours, and D Hours. Make the source range an Excel Table if possible so Power Query automatically keeps the range connection.

Solution 1Recommended

Use Power Query Unpivot Columns in WPS Spreadsheet

This is the most maintainable solution when the source table may grow or change and you want a repeatable data-cleaning process.

Power Query performs the unpivot operation without VBA by selecting the hour columns and converting them from column headers into row values. You can then rename the generated value column and filter out unwanted zero or blank rows before loading the result to another worksheet.

1
Load the source table into Power Query

Click any cell inside the source table, then go to the Data tab and choose From Table/Range. If the range is not already a table, confirm that WPS Spreadsheet should create one.

2
Select the hour columns

In the Power Query Editor, hold Ctrl and select the A Hours, B Hours, C Hours, and D Hours columns.

3
Unpivot the selected columns

Go to Transform > Unpivot Columns. Power Query creates Attribute and Value columns from the selected hour columns.

4
Rename and filter the value column

Right-click the Value column and choose Rename, then type Hours. Open the filter on the Hours column and remove blank values, and uncheck zero if zero-hour rows should not be included.

5
Load the normalized result

Click Close & Load To, choose a new worksheet, and confirm to output the unpivoted Date, Name, and Hours table.

Use Power Query Unpivot Columns in WPS Spreadsheet
Result is refreshable: The output table is connected to the source query, so you can refresh it from the Data tab after updating the source data.
Power Query in WPS Spreadsheet

Unpivot Cross-Tab Data in WPS Spreadsheet with Power Query

Use WPS Spreadsheet to load your Excel cross-tab table into Power Query, unpivot the A Hours through D Hours columns into Date, Name, and Hours rows, filter zero or blank hour values, and load the result to a new worksheet—no VBA required.

  1. 1. Open the workbook in WPS Spreadsheet: Open the Excel file that contains the cross-tab table with Date, Name, and A Hours through D Hours columns.
  2. 2. Open Power Query from the Data tab: Click inside the source table, go to Data > From Table/Range, and confirm the table range in the Power Query dialog.
  3. 3. Unpivot the hour columns: In Power Query Editor, Ctrl-click A Hours through D Hours, then choose Transform > Unpivot Columns.
  4. 4. Rename and filter the Hours values: Rename the Value column to Hours, then use the Hours filter to remove blank and zero values.
  5. 5. Close and load to a new worksheet: Click Close & Load To, select a new worksheet as the destination, and load the Date, Name, and Hours rows.
Built-in Power Query tools for crosstab-to-rows transformation without VBAFull compatibility with Microsoft Excel .xlsx and .xls filesFree and lightweight Office suite with a familiar ribbon interfaceRefreshable query output keeps the normalized table up to dateEasy migration from Microsoft Office with the same menu structure and workflow
microsoft office alternative - wps office

Frequently Asked Questions

Can WPS Spreadsheet unpivot cross-tab data without VBA?

Yes. Load the table into Power Query with Data > From Table/Range, select the A Hours through D Hours columns, and choose Transform > Unpivot Columns. Then rename the Value column to Hours and load the result.

How do I exclude zero or blank hours after unpivoting?

In Power Query Editor, click the filter arrow on the Hours column, clear blank values, and uncheck 0 before applying the filter. The output then contains only non-zero, non-blank hour rows.

Does the Power Query result update when the source table changes?

Yes. Because the output remains connected to the source query, you can refresh it from Data > Refresh All or by right-clicking the result table and choosing Refresh.

Can I use an Excel 365 formula instead of Power Query?

Yes. Excel 365 users can use a dynamic-array formula with LET, TOCOL, HSTACK, FILTER, and LAMBDA to unpivot the hour columns and exclude blank values. However, Power Query is generally more maintainable.

What should I do if the A Hours through D Hours columns are not adjacent?

In Power Query Editor, hold Ctrl and click each hour column individually, then choose Transform > Unpivot Columns. Non-adjacent columns can be selected and unpivoted the same way.