How to Merge Rows with Duplicate Timestamps in Excel Using Power Query
Question details
The user needs to combine multiple Excel rows that share the same timestamp into a single consolidated row, preserving all nonblank values from the other columns for large datasets.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Cleaning and consolidating large datasets where identical timestamps span multiple rows with scattered data points.
- Observed behavior
- Multiple incomplete rows exist for a single timestamp, requiring automated consolidation into one complete row per timestamp.
Ensure your dataset is formatted as an Excel Table (Ctrl+T) so that Power Query can easily capture and refresh the data range when new rows are added.
Consolidate Duplicate Timestamps Using Power Query
Use the Group By feature within Power Query to merge duplicate timestamp rows and aggregate the remaining columns to keep nonblank values.
Power Query is the most efficient tool for handling thousands of records, allowing you to set up rules to group data by specific columns and output a cleaned table.
Select any cell in your data table, go to the Data tab, and click 'From Table/Range' to open the Power Query Editor.
Select your timestamp column, navigate to the Transform tab, and click on 'Group By'.
In the Group By dialog, select 'Advanced'. Group by your timestamp column, and for the remaining columns, add aggregations using operations like 'Max' or 'Sum' (depending on data type) to ensure nonblank values are retained.
Go to Home > Close & Load to generate the combined output on a new worksheet. Whenever the source data changes, simply click Data > Refresh All to update the merged table.

Consolidate Duplicate Data Easily with WPS Office
WPS Spreadsheet offers powerful built-in tools like Data Consolidate and Pivot Tables to quickly aggregate duplicate rows without needing complex queries.
- 1. Open Your Spreadsheet: Launch WPS Spreadsheet and open the file containing your duplicate timestamps.
- 2. Select the Consolidate Tool: Click on a blank cell where you want the merged data. Go to the Data tab and select 'Consolidate'.
- 3. Configure Consolidation Settings: Choose the appropriate function (e.g., Sum or Max) and select the data range containing your timestamps and values.
- 4. Group by the Timestamp Column: Check the box for 'Left column' to ensure the data is grouped by the timestamps, then click OK to instantly generate your merged rows.

Frequently Asked Questions
How do I update the merged data when new timestamps are added?
Add your new rows to the original source table in Excel. Then, go to the Data tab and click 'Refresh All'. Power Query will automatically process the new records and update your output worksheet.
Why are blank cells overwriting my data when I merge rows?
If columns aren't properly aggregated during the 'Group By' step, Power Query might return blanks. Ensure you use an aggregation function like 'Maximum' in the Group By settings to preserve the nonblank data in those columns.
Can I merge rows with duplicate timestamps without using Power Query?
Yes, you can use Pivot Tables or the Data Consolidate tool to group by the timestamp column and aggregate the values. However, Power Query is highly recommended for creating automated, repeatable workflows on large datasets.




