ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Time and lunch breaks (https://www.excelbanter.com/excel-worksheet-functions/156951-time-lunch-breaks.html)

mndpy

Time and lunch breaks
 
Is it possible to subtract two times and automatically have it subtract .5
hours for a lunch break if it is over 5 hours? I'd like to do this all in one
cell. Any suggestions would be helpful!

bj

Time and lunch breaks
 
=A1-B1-if(A1-B15/24,.5/24,0)
formated as time

"mndpy" wrote:

Is it possible to subtract two times and automatically have it subtract .5
hours for a lunch break if it is over 5 hours? I'd like to do this all in one
cell. Any suggestions would be helpful!


Teethless mama

Time and lunch breaks
 
=(B2-A2)*24-((B2-A2)*245)*0.5


"mndpy" wrote:

Is it possible to subtract two times and automatically have it subtract .5
hours for a lunch break if it is over 5 hours? I'd like to do this all in one
cell. Any suggestions would be helpful!


mndpy

Time and lunch breaks
 
That didn't seem to work. I have it set like this

G13 7:30 AM
G14 10:00 PM
G15 14.5

Do I need to have G15 formatted differently? It is general text now. Any
other suggestions would be great! Thanks!

"bj" wrote:

=A1-B1-if(A1-B15/24,.5/24,0)
formated as time

"mndpy" wrote:

Is it possible to subtract two times and automatically have it subtract .5
hours for a lunch break if it is over 5 hours? I'd like to do this all in one
cell. Any suggestions would be helpful!


bj

Time and lunch breaks
 
if you want it as a number and g13 and g14 are formated as time
in g15
=mod(g14-g13,1)*24-if(mod(g14-g13)*255,.5,0)
this will allow you to go over midnight and still have the correct answer

"mndpy" wrote:

That didn't seem to work. I have it set like this

G13 7:30 AM
G14 10:00 PM
G15 14.5

Do I need to have G15 formatted differently? It is general text now. Any
other suggestions would be great! Thanks!

"bj" wrote:

=A1-B1-if(A1-B15/24,.5/24,0)
formated as time

"mndpy" wrote:

Is it possible to subtract two times and automatically have it subtract .5
hours for a lunch break if it is over 5 hours? I'd like to do this all in one
cell. Any suggestions would be helpful!


Keyrookie

I tried the suggested formula and it works fine!!! You might want to try again.

Quote:

Originally Posted by mndpy (Post 550499)
That didn't seem to work. I have it set like this

G13 7:30 AM
G14 10:00 PM
G15 14.5

Do I need to have G15 formatted differently? It is general text now. Any
other suggestions would be great! Thanks!

"bj" wrote:

=A1-B1-if(A1-B15/24,.5/24,0)
formated as time

"mndpy" wrote:

Is it possible to subtract two times and automatically have it subtract .5
hours for a lunch break if it is over 5 hours? I'd like to do this all in one
cell. Any suggestions would be helpful!



All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com