Reputation: 1
Simple table within employee names going down in column A and working day numbers across the top from column B - stated as 1,2,3,4 etc up to 31.
Each day we enter hours worked.
At the end of each row I want a sum for the hours worked based on a specified day. Ie if I enter working day = 15 in a cell at top of the sum column it will return totals for days 1-15.
Upvotes: 0
Views: 157
Reputation: 21
You want to use SUM(OFFSET(....)) here.
Assuming your "Working Days" cell is AH1
and your day numbers are in B:AF
, an formula for each row (starting in row 2) would be:
=SUM(OFFSET(B2,0,0,1,$AH$1))
.
This uses OFFSET to return a dynamic range so that you can sum up hours worked from day 1 to whatever day you put in cell AH1.
Upvotes: 0