Power Query Problems

How to Extract Work Dates from Task Headcount Data in Excel

Steve KSteve K Oct 13, 2026 869 views

Question details

The user needs to extract dates from column headers based on task rows where daily headcount values are entered, filtering out days with no work.

How to Extract Work Dates from Task Headcount Data in Excel
Product
Excel
Device & OS
not provided
Scenario
Transforming a matrix of task names and date columns into a flat list of tasks and active work dates to support a Gantt chart.
Observed behavior
The data is organized with dates as horizontal column headers, making it difficult to directly isolate work and idle periods for project visualization.
Before you start

Ensure your dataset is formatted as an official Excel Table (Ctrl+T) and verify that all column headers containing dates are formatted consistently so they can be accurately parsed.

Solution 1Recommended

Use Power Query to Unpivot Date Columns

Power Query is the most robust method to unpivot horizontal date headers into a vertical list, allowing you to easily filter out empty or zero-headcount dates.

Unpivoting transforms your matrix format into a tabular format, which is the ideal data structure for PivotTables and Gantt charts.

1
Load data into Power Query

Select any cell in your data table, navigate to the Data tab, and click 'From Table/Range' to open the Power Query Editor.

2
Select static columns

Hold the Ctrl key and select the columns that do not contain dates, such as 'Task Name' or 'Task ID'.

3
Unpivot the date columns

Right-click the header of one of your selected static columns and choose 'Unpivot Other Columns'. This turns your date headers into a new 'Attribute' column and the headcounts into a 'Value' column.

4
Format and filter the data

Rename 'Attribute' to 'Date' and change its data type to Date. Rename 'Value' to 'Headcount'. Click the filter dropdown on the Headcount column and uncheck 'null' and '0' to remove idle periods.

5
Load the transformed data

Click 'Close & Load' on the Home tab to output your clean, vertical list of work dates to a new worksheet.

Use Power Query to Unpivot Date Columns
Ready for Visualization: Your data is now in a flat structure, perfectly optimized for creating PivotTables or mapping out work periods on a Gantt chart.

Manage Task Data and Build Charts Easily in WPS Spreadsheet

WPS Spreadsheet provides powerful dynamic array formulas, PivotTable capabilities, and charting tools to help you extract task work dates and visualize project timelines effortlessly.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open your existing task and headcount file.
  2. 2. Extract the data: Utilize WPS Spreadsheet's dynamic lookup functions or PivotTable tools to isolate active dates where headcounts are recorded.
  3. 3. Create a Gantt chart: Highlight your extracted task dates, navigate to the Insert tab, and select a Stacked Bar chart to visualize your project's active and idle periods.
Seamless compatibility with Microsoft Excel (.xlsx) formats and dynamic array functions.Easily filter and restructure complex datasets using built-in data transformation tools.Access built-in templates and advanced charting to generate professional Gantt charts in seconds.Lightweight, fast, and completely free to download and use.
microsoft office alternative - wps office

Frequently Asked Questions

Why do my unpivoted date headers appear as text or random numbers?

This occurs because Power Query initially interprets the unpivoted headers as generic text attributes. You can fix this by clicking the data type icon on the left side of the new column header and selecting 'Date' to convert them into standard calendar dates.

How do I ensure idle periods don't appear in my final Gantt chart?

When using Power Query, you must filter the newly created 'Values' (Headcount) column. Click the filter dropdown and uncheck '0' and '(null)'. This ensures only days with active work are passed to your chart data.

Can I automatically refresh the extracted dates when headcount numbers change?

Yes. If you used Power Query, right-click anywhere in your output table and select 'Refresh' to update the data. If you used dynamic array formulas like FILTER, the results will update instantly as soon as you change a headcount value.