How to Compare Expected and Actual Project Hours in Excel Using Power Query
Question details
The user needs to compare planned project hours against actual worked hours to generate a summary of the differences.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking and managing project time by evaluating the variance between expected and actual hours.
- Observed behavior
- A comparison summary is generated showing the differences between expected and actual data.
Ensure that your expected and actual project hours are formatted as standard Excel tables (using the shortcut Ctrl+T) so they can be easily imported into Power Query.
Using Power Query to Merge and Compare Data Tables
The most efficient way to compare two sets of project hours in Excel is by utilizing Power Query to merge your planned and actual tables based on a common identifier.
Power Query allows you to create a dynamic connection between your expected and actual data. By merging the tables, you can easily calculate variances without relying on complex, fragile cell formulas.
Select your expected hours data and press Ctrl+T to convert it into a Table. Name it 'ExpectedHours' in the Table Design tab. Repeat this process for your actual hours data and name it 'ActualHours'.
Click anywhere inside the 'ExpectedHours' table, go to the Data tab, and select 'From Table/Range'. Once the Power Query Editor opens, click 'Close & Load To' and choose 'Only Create Connection'. Do the exact same for the 'ActualHours' table.
Go to Data > Get Data > Combine Queries > Merge. Select 'ExpectedHours' as your first table and 'ActualHours' as the second. Click on the common identifier column (e.g., Task ID or Project Name) in both previews to link them, then click OK.
In the Power Query Editor, click the expand icon on the new 'ActualHours' column header to reveal the actual hours. Go to Add Column > Custom Column, and enter a formula subtracting actual hours from expected hours (e.g., [Expected] - [Actual]).
Click Home > Close & Load. Excel will output a brand-new table containing your merged data and the calculated differences. Whenever your original tables change, navigate to Data > Refresh All to update this summary automatically.

How to Compare Project Hours in WPS Spreadsheet
WPS Spreadsheet offers powerful built-in functions to compare expected and actual project hours effortlessly. By using simple lookup functions, you can quickly analyze discrepancies and track your project's performance without advanced query setups.
- 1. Open your project data: Launch WPS Spreadsheet and open the workbook containing your expected and actual project hours.
- 2. Identify a common key: Ensure both data sets share a common identifier, such as a unique Task ID or Project Code, to accurately match the records.
- 3. Use a lookup formula: In your Expected Hours sheet, create a new column called 'Actual Hours'. Use the formula =XLOOKUP(A2, ActualSheet!A:A, ActualSheet!B:B) to pull in the worked hours.
- 4. Calculate the variance: Create a final column named 'Difference' and subtract the Actual Hours from the Expected Hours to immediately summarize your time discrepancies.

Frequently Asked Questions
Can I use standard Excel formulas instead of Power Query to compare hours?
Yes. You can use lookup formulas like VLOOKUP, XLOOKUP, or INDEX/MATCH to pull the actual hours next to the expected hours based on a common Task ID, and then simply subtract the two values in an adjacent column.
Why isn't my Power Query summary updating when I change the actual hours?
Power Query does not update automatically in real-time. You must manually trigger the update by navigating to the Data tab and clicking 'Refresh All', or right-clicking anywhere on the output table and selecting 'Refresh'.
What if my planned and actual hours have different task names?
For Power Query to merge tables successfully, both tables need a common identifier. If the names differ, you will need to create a mapping table to link the different names, or standardize the Task IDs before performing the merge.




