How to Convert Multiple Event Phases from One Row into Gantt Chart Rows
Question details
The user needs to transform event phase data stored in a single row into multiple rows to create a Gantt chart.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Preparing a large dataset containing event phases and dates for a Gantt chart visualization.
- Observed behavior
- Data is structured horizontally with multiple phases and dates in one row, but needs to be restructured vertically so each phase has its own row with corresponding start and end dates.
Ensure your dataset contains a unique identifier, such as an Event ID, which is essential for accurately unpivoting and grouping the data in Power Query.
Use Power Query to Restructure the Data
The most efficient method for large datasets is to use Power Query to unpivot the phase columns and then pivot the date types.
Power Query is highly recommended for this scenario because it effortlessly handles large volumes of data and allows you to automate the transformation process. By unpivoting the columns, you convert the wide data format into a long format, which is required for plotting Gantt charts.
Select your data table, navigate to the Data tab, and click 'From Table/Range' to open the Power Query Editor.
Select the 'Event ID' column, right-click on the column header, and choose 'Unpivot Other Columns'. This will collapse all your event phases and dates into two new columns: Attribute and Value.
Select the new Attribute column. If there is a 'Phase' prefix, use the 'Replace Values' feature to remove it. Then, use 'Split Column' by delimiter to separate the phase name from the date type (Start or End).
Select the column that contains the 'Start' and 'End' identifiers. Go to the Transform tab, click 'Pivot Column', and select your date values column as the Values Column. Ensure the advanced options are set to 'Don't Aggregate'.
Select the newly created Start Date and End Date columns, click the data type icon in the column header, and change the data type to 'Date'. Finally, click 'Close & Load' to output the restructured data.

Use Spreadsheet Formulas as an Alternative
If you cannot use Power Query, you can restructure the data using a combination of INDEX, MATCH, and IF formulas.
Try WPS Office for Seamless Spreadsheet Management
While Power Query is a built-in feature of Microsoft Excel, WPS Office offers a free, lightweight, and highly compatible alternative for data processing and Gantt chart creation. Enjoy seamless format compatibility and a familiar user interface.

Frequently Asked Questions
What does unpivoting data do in Power Query?
Unpivoting transforms columns into rows, changing a wide dataset into a long dataset. This is essential when multiple event phases are spread horizontally across columns but need to be separate vertical records for chart generation.
Can I restructure this data using just spreadsheet formulas?
Yes, you can use a combination of INDEX, MATCH, and IF functions to restructure the data. However, Power Query is generally preferred for larger datasets to ensure better performance and easier updates.
Why are my Start and End Dates not recognized correctly by the Gantt Chart?
After pivoting your date columns in Power Query, you must explicitly change their data type to 'Date'. If they are left as text or general formatting, the Gantt chart will not be able to plot the timeline correctly.
How do I remove prefixes from my phase names during transformation?
You can use the 'Replace Values' feature in the Power Query Editor to find the specific prefix (e.g., 'Phase ') and replace it with a blank space, or use the 'Split Column' feature to separate the text before pivoting.




