JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
785
Office Version
  1. 365
Platform
  1. Windows
Hi,
if i have the following in the format below:

Shift Times:
08:00-17:00
08:00-17:00
08:00-17:00
08:00-17:00
08:00-17:00
08:30-17:30
08:30-17:30
08:30-17:30
08:30-17:30
08:30-17:30
09:00-18:00
09:30-18:30
10:00-19:00

Hour - answers in red which i need formula for (Total hours from available users - example hour 08 - 5 users start at 08:00 = 5 hours plus 5 start at 08:30 = 2.5)
08 - 7.5
09 - 12
10 - 13

Ones who start 08:00 and 08:30 are added to 09:00 as its within their hours

Thanks for any help, i know this looks confusing. I think im best to start converting these into numeric values like 08:00 = 80000 and 08:30 = 80500
 
Re: Need help with Time Formula please

Thanks WBD. For some reason, part of the formula keeps getting truncated. I'll try again:

Code:
<c2,if((timevalue(mid(a$2:a$14,find("-",a$2:a$14)+1,10))*24)>=SUM(IF(VALUE(LEFT(A$2:A$14,2)) < C2,IF((TIMEVALUE(MID(A$2:A$14,7,10))*24) > C2,1,0),0))+SUM(IF(VALUE(LEFT(A$2:A$14,2))=C2,IF(VALUE(MID(A$2:A$14,4,2))=0,IF((TIMEVALUE(MID(A$2:A$14,7,10))*24) > C2,1,0),0),0))+SUM(IF(VALUE(LEFT(A$2:A$14,2))=C2,IF(VALUE(MID(A$2:A$14,4,2))=30,IF((TIMEVALUE(MID(A$2:A$14,7,10))*24) > C2,0.5,0),0),0))

Yup. Even in the CODE tags the "<" were being treated as HTML markers. Had to add spaces to get it to read properly.
@JumboCactuar, sorry for the confusion there. This site has some glitches.</c2,if((timevalue(mid(a$2:a$14,find("-",a$2:a$14)+1,10))*24)>
 
Last edited:
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Re: Need help with Time Formula please

@JumboCactuar, I combined @wideboydixon's formula with a second half in line with mine to produce a formula that I believe will now be accurate both for time clocked in and time clocked out (again, be sure to confirm with Ctrl+Shift+Enter):

Code:
=COUNTIFS($A$2:$A$14,"<="&TEXT(TIME($C2,0,0),"hh:mm")&"-9")+(COUNTIF($A$2:$A$14,TEXT(TIME($C2,30,0),"hh:mm")&"*")/2)-SUM(IF(VALUE(MID($A$2:$A$14,7,2)) <= C2,1,0))+SUM(IF(VALUE(MID($A$2:$A$14,7,2))=C2,IF(MID($A$2:$A$14,10,2)="30",0.5,0)))
 
Last edited:
Upvote 0
Re: Need help with Time Formula please

Haha. I did something similar:


Book1
ABCD
1Shift Times:HourAvailable
208:00-17:00087.5
308:00-17:000911.5
408:00-17:001013
508:00-17:001113
608:00-17:001213
708:30-17:301313
808:30-17:301413
908:30-17:301513
1008:30-17:301613
1108:30-17:30175.5
1209:00-18:00181.5
1309:30-18:30190
1410:00-19:00200
Sheet1
Cell Formulas
RangeFormula
D2{=SUM(IF(TIMEVALUE(LEFT($A$2:$A$14,5))<=TIME($C2,0,0),1,0))+SUM(IF(TIMEVALUE(LEFT($A$2:$A$14,5))=TIME($C2,30,0),1,0))/2-SUM(IF(TIME($C2,0,0)>=TIMEVALUE(RIGHT($A$2:$A$14,5)),1,0))-SUM(IF(TIMEVALUE(RIGHT($A$2:$A$14,5))=TIME($C2,30,0),1,0))/2}
Press CTRL+SHIFT+ENTER to enter array formulas.


It's a beast of a formula :)

WBD
 
Upvote 0
Re: Need help with Time Formula please

Thanks for the effort guys, impressive formula :)

Working perfectly
 
Upvote 0
Re: Need help with Time Formula please

Using the same data setup as @wideboydixon, you can use this:

Code:
=SUMPRODUCT(COUNTIF($A$2:$A$14,TEXT(C$1:C2,"00")&"*"))-
         COUNTIF($A$2:$A$14,TEXT(C2,"00")&":30*")/2
 
Last edited:
Upvote 0
Re: Need help with Time Formula please

Using the same data setup as @wideboydixon, you can use this:

Code:
=SUMPRODUCT(COUNTIF($A$2:$A$14,TEXT(C$1:C2,"00")&"*"))-
COUNTIF($A$2:$A$14,TEXT(C2,"00")&":30*")/2

As stated, that doesn't take into account the finish times of the shifts. In the hour 18:00-19:00 for example, there are only 1.5 man hours available.

WBD
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,053
Members
449,206
Latest member
Healthydogs

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