How to Sum Staff Hours by Milestone and Week in Excel
Question details
The user needs to calculate and aggregate staff hours conditionally, summing the hours only when a specific milestone is scheduled during a selected week for a designated staff member.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking project management data where milestones are mapped by week, hours are assigned by staff member, and a combined output table needs to show total hours per staff member per week.
- Observed behavior
- The user needs a dynamic output table that accurately calculates the staff-by-week aggregated hours by cross-referencing multiple data matrices.
Ensure your workbook data is neatly organized into specific ranges: one area for the milestone schedule (marked by week) and another for staff assignments mapping milestone hours.
Use a Matrix Calculation Combining SUMPRODUCT and XLOOKUP
Use SUMPRODUCT to evaluate multiple condition arrays and multiply the result by the target staff member's hours retrieved via XLOOKUP.
This solution works by multiplying boolean arrays (True/False represented as 1/0) against an array of staff hours. When all conditions are met—the week matches, the milestone exists, and the schedule is marked—the formula returns the required hours.
Make sure your milestone schedule is on 'Tab A' (milestones in column A, week headers in row 1, 'X' for scheduled). Place your staff hours on 'Tab B' (staff names in column A, corresponding milestone hours in columns B through Z).
In your final output table where you want the summed hours, enter the following formula: =SUMPRODUCT((TabA!$B$1:$Z$1=B$1)*(TabA!$A$2:$A$100<>"")*(TabA!$B$2:$Z$100="X")*XLOOKUP($A2,TabB!$A$2:$A$100,TabB!$B$2:$Z$100,0))
Modify the sheet names (TabA, TabB) and the specific range addresses (like $A$2:$A$100) to perfectly match the dimensions of your actual workbook data. Ensure absolute references ($) are used so you can drag the formula across the rest of the table.

Calculate Complex Project Data Easily in WPS Spreadsheet
WPS Spreadsheet fully supports advanced array formulas like SUMPRODUCT and XLOOKUP, allowing you to seamlessly manage project milestones and staff hours across massive data sets.
- 1. Open your workbook: Launch WPS Spreadsheet and open your project management file containing the milestone and staff tables.
- 2. Select the target cell: Click on the first cell of your final staff-by-week output table.
- 3. Apply the formula: Paste your combined SUMPRODUCT and XLOOKUP matrix formula into the formula bar and press Enter.
- 4. Fill the table: Drag the fill handle across the rows and columns to automatically calculate the hours for all staff members and weeks.

Frequently Asked Questions
Why does my SUMPRODUCT formula return a #VALUE! error?
A #VALUE! error in SUMPRODUCT usually occurs when the array ranges provided in the formula are not exactly the same size. Double-check that all ranges (e.g., $A$2:$A$100 and $B$2:$Z$100) encompass the exact same number of rows and columns as intended.
Can I use INDEX and MATCH instead of XLOOKUP?
Yes. If you are using an older version of Excel that does not support the XLOOKUP function, you can replace the XLOOKUP portion of the formula with an INDEX/MATCH combination to retrieve the array of staff hours.
How can I calculate partial hours instead of using an 'X' for scheduling?
Instead of marking scheduled weeks with an 'X', you can input decimal percentages (like 0.5 for half a week) directly into the milestone matrix. Update the formula to multiply by the cell's actual value instead of checking for the text 'X'.




