MS Excel Formula Help

CommSecy

Board Regular
Joined
Mar 21, 2017
Messages
68
I have a "time sheet" with 55 members working various hours. Right now, I am manually entering the numbers in green, which is labor-intensive. I want to add a formula that will add only the hours that fall between 1500 and 0700.
Any help would be very much appreciated.

1718738007738.png
1718738146859.png


Thank you. :)
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
A concise example of your challenge can be posted with the forum's tool named XL2BB.

The following may help you.
Dates and Time 2024.xlsm
ABCD
1StartEndTime
215:0007:0016:00
3
4b
Cell Formulas
RangeFormula
D2D2=MOD(C2-B2,1)
 
Upvote 0
Dates and Time 2024.xlsm
ABCDE
1StartEndTimeTime
219:0007:0012:0012:00
319:0007:0012:0012:00
419:0007:0012:0012:00
522:0007:0009:0009:00
614:0023:0009:0009:00
7
4b
Cell Formulas
RangeFormula
D2:D6D2=MOD(C2-B2,1)
E2:E6E2=C2-B2+(B2>C2)
Thank you for your time & reply; however, the formula does not work as 14-23 should result in a total of 8hrs, not 9. Whatever the start and end times, I only want to add hours falling between 1500 and 0700 as that is the only hours that night differential pay applies. for instance, see examples below:
0700-1600 should result in a 1hr night diff
1300-2200 should result in 7hrs night diff

I am looking for a formula/workaround so that I do not have to manually input night diff hours if one exists.

I apologize if I did not initially explain my situation correctly. right now, I have a drop-down using the sumif formula to fill in all the different scenarios of night diff. I would like to avoid that if possible....
 
Upvote 0
Dates and Time 2024.xlsm
ABCDEFG
1StartEndTimeTime15:0007:00
7
814:0023:0008:0008:00
4b
Cell Formulas
RangeFormula
D8D8=MOD(C8-MAX(B8,F1),1)
E8E8=LET(t,MAX(B8,F1),C8-t+(t>C8))
 
Upvote 0
If a formula exists to add ONLY hours that fall between 1500 and 0700 the next day, I would like to be able to add (get a total) of only the hours worked between 1500 and 0700, which falls into night diff pay. So regardless of what time someone starts or ends their tour I only want a total of hours worked between the hours of 1500 and 0700. Obviously, being a 24-hour department, I have a ridiculous number of combinations, so the formula would have to pull only the hours worked between 1500 and 0700. I do not know if this is even possible. If it is, it is certainly above my ability to work out. Thank you,
 
Upvote 0
1718816637127.png

I found this and tried the formula above, and it's not working, but I think it should. What am I doing wrong?

Thank you!
 
Upvote 0
You can review this fragment that yields the number of hours.
You did not post an extract of your sheet that we can use.
Dates and Time 2024.xlsm
CDEFGHIJKLM
1
210:00 PM7:00 AM09:007:00 AM
33:00 PM
4
4b
Cell Formulas
RangeFormula
K2K2=MOD(MIN(D2,M2)-MAX(C2,M3),1)
 
Upvote 0
You can review this fragment that yields the number of hours.
You did not post an extract of your sheet that we can use.
Dates and Time 2024.xlsm
CDEFGHIJKLM
1
210:00 PM7:00 AM09:007:00 AM
33:00 PM
4
4b
Cell Formulas
RangeFormula
K2K2=MOD(MIN(D2,M2)-MAX(C2,M3),1)
Thank you, I will try that now...
 
Upvote 0

Forum statistics

Threads
1,221,602
Messages
6,160,739
Members
451,669
Latest member
Peaches000

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