Calculating Sum of hours horizontally, based on incremental date columns

benobee

New Member
Joined
Jul 7, 2002
Messages
45
Hi there

Not sure how to approach this, but the problem is as the title describes.

I have columns that correspond to incremental weeks. On each row is a person's name.

I want to calculate the sum of the actual number of hours worked by a person, depending on the week.

The week is stipulated in a separate cell on a separate sheet for reference (let's say in Summary!$A$1).

So as an example, the sheet looks like this:

Name---Actual Hours To Date---1 June---8 June---15 June---22 June
David----------[ ??? ]------------- 40 ----- 20 ------ 10 ------- 0 ---

So if Summary!$A$1 = 8th June, then the Actual Hours To Date will be 60.

If Summary!$A$1 = 15th June, then the Actual Hours should read 70.

Any help would be appreciated.

Many thanks

Ben
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi,

Try this:


Book1
ABCDEF
1NameActual Hours To Date1-6-20188-6-201815-6-201822-6-2018
2David704020100
Sheet1
Cell Formulas
RangeFormula
B2=SUM(OFFSET(C2,0,0,1,MATCH(summary!A1,Sheet1!C1:F1,0)))
 
Upvote 0
Hi jorismoerings

Thanks for your input. This looks like it's exactly what I need! Much appreciated.

Kind Regards

Ben
 
Upvote 0
And two further questions, if I may:

1. How would I calculate the reverse (i.e. all FUTURE hours from the specified date)?
2. how would the formula change if I wanted to calculate the total number of hours across the entire row, irrespective of date? (let's assume the columns extend all the way to Column CY)
 
Last edited:
Upvote 0
Hi,

Another approach same result with Summary $A$1 being 8-6-2018:



Book1
ABCDEFGH
1NameActual Hours To DateFuture HoursTotal Hours1-6-20188-6-201815-6-201822-6-2018
2David6010704020100
Sheet1
Cell Formulas
RangeFormula
B2=SUMPRODUCT(($E$1:$CY$1<=summary!$A$1)*($E$2:$CY$2))
C2=SUMPRODUCT(($E$1:$CY$1>summary!$A$1)*($E2:$CY2))
D2=SUM(E2:CY2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top