May 25 2023 11:20 PM
How do I get the hours worked to not be negative numbers and to be correct? They are employees that work a 10 (3p-1a) or 12 hour (3p-3a) shift. Their shift starts "today" and ends "tomorrow".
May 25 2023 11:43 PM
May 25 2023 11:50 PM
May 25 2023 11:52 PM
May 26 2023 12:02 AM
Is there a way that I can get the OT Hrs to be a whole number? I was hoping that I could take the hours worked and subtract the normal shift to calculate over time hours but it gives the error message.
May 26 2023 01:10 AM
@CatherineMadden Presumably I4 contains 8 based on a time format. Thus the underlying number value is 8/24. That's how Excel stores times. If the 8 in A4 is the plain number 8, the formula will return a negative value that you can not display as time. Change the formula to
=I4-A4/24
That should work.
May 26 2023 01:12 PM - edited May 26 2023 03:40 PM
Riny's formula is valid to get an elapsed time value (duration) into AO4, but it could produce negative numbers. Consider this instead:
=MAX( (I4-A4/24), 0 )
(In all these examples, the spaces are not required, but are included for readability.)
But if you need an actual whole number there, you need to decide how that should be calculated, as employees may work partial hours as well (I presume). E.g., what if Jane actually worked some minutes after 11:00 PM? Try one of these formulas:
To ignore fractions of an hour:
=ROUNDDOWN( MAX( (I4-A4/24) * 24, 0 ), 0 )
To round up at half an hour:
=ROUND( MAX( (I4-A4/24) * 24, 0 ), 0 )
If working any portion of an hour gets you wages for the full hour:
=ROUNDUP( MAX( (I4-A4/24) * 24, 0 ), 0 )
Edit: I was in a hurry, and messed up the alternative to Riny's formula. It's fixed now.