Countifs is not helping, any suggestions?

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Your output table isn't long enough.
You've only catered for 24hrs which covers only ONE occurrence of 06:00

Employee 2 works 0400-1300 so he's working at 06:00

Employee 13 starts his shift at 22:00 and works until 07:00 so he's also here at 06:00, but that's 06:00 the NEXT day and your table doesn't cover that time range.


This may be why your COUNTIFS results are inot as expected.
 
Last edited:
Upvote 0
Consider:


Book1
ABCDEFGHI
1EmployeeStart TimeEnd TimeIntervalInterval
2Employee 11:00:00 PM10:00:00 PM1:00 AM01:00 AM0
3Employee 24:00:00 AM1:00:00 PM2:00 AM02:00 AM0
4Employee 33:00 AM03:00 AM0
5Employee 44:00 AM24:00 AM2
6Employee 57:00:00 AM4:00:00 PM5:00 AM25:00 AM2
7Employee 66:00 AM26:00 AM2
8Employee 77:00 AM57:00 AM5
9Employee 87:00:00 AM4:00:00 PM8:00 AM58:00 AM5
10Employee 91:00:00 PM10:00:00 PM9:00 AM59:00 AM5
11Employee 1010:00:00 AM7:00:00 PM10:00 AM610:00 AM6
12Employee 1110:00:00 PM7:00:00 AM11:00 AM611:00 AM6
13Employee 1212:00 PM612:00 PM6
14Employee 1310:00:00 PM7:00:00 AM1:00 PM71:00 PM7
15Employee 142:00 PM72:00 PM7
16Employee 153:00 PM73:00 PM7
17Employee 164:00 PM44:00 PM5
18Employee 177:00:00 AM4:00:00 PM5:00 PM45:00 PM5
19Employee 184:00:00 PM1:00:00 AM6:00 PM46:00 PM5
20Employee 194:00:00 AM1:00:00 PM7:00 PM37:00 PM4
21Employee 208:00 PM38:00 PM4
22Employee 219:00 PM39:00 PM4
23Employee 2210:00 PM010:00 PM3
24Employee 2311:00 PM011:00 PM3
25Employee 241:00:00 PM10:00:00 PM12:00 AM011:59 PM3
Sheet2
Cell Formulas
RangeFormula
F2=SUMPRODUCT(--(B$2:B$25<=E2),--(E2))
I2{=SUMPRODUCT(--(B$2:B$25<=H2),--(H2B$2:B$25)),--(B$2:B$25<>""))}
Press CTRL+SHIFT+ENTER to enter array formulas.



The F2 formula is the rough equivalent of a SUMIFS. But as Special-K99 said, there are definite issues when you have shifts that overlap into the next day. The formula in I2 attempts to handle that as much as possible on a one-day timeframe. (Also note the time change in the H25 cell.) There are still issues though, but that'll probably require some design changes to handle. See if this works well enough for you.
 
Upvote 0
Yeah I am fully aware of the shift issue that overlap into the next day, but at least I have now something to begin with. Thanks for help!
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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