Time formula

rkramapo

New Member
Joined
Feb 28, 2024
Messages
6
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi- I have a question on how I can edit this IF formula to reflect the correct time when an employee schedule end time is at 12am. The total works for times after 12am. Let's say cell p40 is 6p and cell o40 is 12am and any hours worked greater than 5 requires a half hour break- the total hours pops up as -18

=IF(P40*24-O40*24<5, P40*24-O40*24, P40*24-O40*24-0.5)
 
With Excel 2016, try the second formula

Dates and Time 2024.xlsm
OPQR
39StartEnd
4018:00:0012:0017.5017.5
41
2e
Cell Formulas
RangeFormula
Q40Q40=LET(t,(P40-O40+(O40>P40))*24,IF(t<5,t,t-0.5))
R40R40=IF((P40-O40+(O40>P40))*24<5,(P40-O40+(O40>P40))*24,(P40-O40+(O40>P40))*24-0.5)
 
Upvote 0
Solution

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
With Excel 2016, try the second formula

Dates and Time 2024.xlsm
OPQR
39StartEnd
4018:00:0012:0017.5017.5
41
2e
Cell Formulas
RangeFormula
Q40Q40=LET(t,(P40-O40+(O40>P40))*24,IF(t<5,t,t-0.5))
R40R40=IF((P40-O40+(O40>P40))*24<5,(P40-O40+(O40>P40))*24,(P40-O40+(O40>P40))*24-0.5)
awesome thanks!
 
Upvote 0
Review the formula with Excel's Formula Evaluation

Dates and Time 2024.xlsm
ABCDEF
1Employee'sFriday
2 NameShiftHours
3MiledySuper7:3016:0088.00
4Steve Super00.00
5JordanSuper16:000:157.757.75
6 Janet GCash 17:0015:3088.00
7DannaCash 200.00
8Charlotte Cash 315:0023:3088.00
9Luis C FSW 17:3015:307.57.50
10John B. FSW 29:0016:006.56.50
11JulissaFSW 300.00
12LORETA FSW 416:0023:457.257.25
13AliciaFSW400.00
14MarthaFSW612:0020:3088.00
15LucyFSW 1416:0023:457.257.25
16CARLOS Grill 16:3015:0088.00
17Lionel D. Grill 211:4520:1588.00
18Patty CGrill 300.00
19Ysabel R Grill 416:000:157.757.75
20Clara R. Grill 516:0023:457.257.25
21WilliamGrill 600.00
22RyanGrill 700.00
23Patrick Grill 816:0023:457.257.25
24TINA DCOOK 1 7:3016:0088.00
25OPEN Cook 211:0018:006.56.50
26BRIAN C. Cook 36:3015:0088.00
27GAVIN Cook 49:0017:157.757.75
28MaryCook 59:1517:4588.00
29RadcliffCOOK 612:0020:3088.00
30BRIAN O. UT 17:3014:306.56.50
31Felipe UT 29:0017:3088.00
32Jean T. UT 316:000:157.757.75
33MELVIN UT 416:000:157.757.75
34EMILIO UT 500.00
35ElimaUT 616:000:157.757.75
36CesarUT 700.00
37OPEN UT 800.00
38Student18:00-185.50
2ee
Cell Formulas
RangeFormula
E3:E38E3=IF(D3*24-C3*24<5, D3*24-C3*24, D3*24-C3*24-0.5)
F3:F38F3=IF((D3-C3+(C3>D3))*24<5,(D3-C3+(C3>D3))*24,(D3-C3+(C3>D3))*24-0.5)



There are several workarounds for Midnight. One is to enter 1 second instead of leaving the cell blank.
Student18:000:00
-18.00​
5.50​
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,095
Latest member
nmaske

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