Work schedule calculation

tht78

New Member
Joined
Mar 3, 2018
Messages
2
Hi! Hopefully someone can push in the right direction with my excel problem. Attached is a sample of my spreadsheet. It is a work schedule for several persons on several different work shifts, all with different lengths. My goal is to add a overview for each person with the total number of hours worked per week. I would prefer to do the calculation in one cell for each person because any use of helper colums or tables would increase dramatically when i expand number of people and number of shifts.
If the shifts were all the same length it would be no problem. I could just do a COUNTIF(C3:J7, person)*shiftlength. But when each shift has a unique length i will have to calculate each row one by one and then add them. I have not succeeded in finding a way to do this in a single cell calculation yet.
The calculation SUM({array_of_shifts}*{array_of shiftlengths}) CTRL-SHIFT-ENTER will produce the correct answer, but how do I get to the first array??
Excel_problem.PNG
I want the COUNTIF to produce one answer for each row/shift, not a total for the whole range.
ldZpG6j.png
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Welcome to the Board!

Try this:

Excel 2012
ABCDEFGHI
1Week 1
2ShiftHrs/DaymontuewedthufriSatSun
3Morning8.5JohnJohnJohnLisaLisa
4Evening8LisaLisaGaryGaryGary
5Night7.5PaulPaulPaulPaulJohn
6Weekend Day11.75LisaLisa
7Weekend Night12.25JohnJohn
8Week 2
9
10ShiftHrs/DaymontuewedthufriSatSun
11Morning8.5LisaLisaLisaPaulPaul
12Evening8PaulPaulJohnJohnJohn
13Night7.5GaryGaryGaryGaryLisa
14Weekend Day11.75PaulPaul
15Weekend Night12.25LisaLisa
16
17Hrs/weeks
18EmployeeWeek 1Week 2Total
19John57.52481.5
20Lisa56.557.5114
21Gary243054
22Paul3056.586.5

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B19=SUMPRODUCT(($C$3:$I$7=$A19)*$B$3:$B$7)
C19=SUMPRODUCT(($C$11:$I$15=$A19)*$B$11:$B$15)
D19=SUM(B19:C19)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Thank you Eric! That simple, huh? I was sure I had tried that formula but apparently not. I see it works with both SUM and SUMPRODUCT also but the latter is perhaps preferred?
 
Upvote 0
Yes, you can use SUM with Control+Shift+Enter. I have read that SUMPRODUCT is a bit more efficient than SUM, but the overall processing is the same. I doubt you'd notice any difference unless you had LOTS of formulas. SUMPRODUCT doesn't require CSE either, which is a plus for some people.

Glad to help! :cool:
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,560
Members
449,089
Latest member
Motoracer88

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