ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Assumed Lunch (https://www.excelbanter.com/excel-discussion-misc-queries/18422-assumed-lunch.html)

Jeff

Assumed Lunch
 
Please help,

I need a VB code for assumed lunch.

=(E6<D6)+E6-D6+(G6<F6)+G6-F6 is the code I am currently using to calculate
total hours worked per day.
D6 is "StartWork", E6 is "StartLunch", F6 is "EndLunch" G6 is "EndWork".

Our employees do not punch out for lunch unless if they are going to be
longer than 1/2 hour. Otherwise we just assume 1/2 hour or "no lunch" if
they write "no lunch" on their card.

To address the assumed lunch:
What I need is a VB code so that what I enter in "StartWork" (E6) is
automaticaly repeated in "StartLunch" (F6) and puts the time that is 1/2
hour later in "EndLunch".

I already have a macro to address the no lunch issue.

Thank you,
Jeff

Bill Kuunders

no macro's
just an if function

assume A1 is start time entered as 08:00
B1 is end time entered as 16:30
in C1 you enter 0 if no lunch
or for example 1.5 if lunch was longer than 0.5
or you leave it empty for most cases.
enter formula in D1 =IF(C10.5,C1,IF(C1="",0.5,0))
enter formula in E1 =((A1B1)+B1-A1)*24-D1

Regards
Bill K

"Jeff" wrote in message
...
Please help,

I need a VB code for assumed lunch.

=(E6<D6)+E6-D6+(G6<F6)+G6-F6 is the code I am currently using to
calculate
total hours worked per day.
D6 is "StartWork", E6 is "StartLunch", F6 is "EndLunch" G6 is "EndWork".

Our employees do not punch out for lunch unless if they are going to be
longer than 1/2 hour. Otherwise we just assume 1/2 hour or "no lunch" if
they write "no lunch" on their card.

To address the assumed lunch:
What I need is a VB code so that what I enter in "StartWork" (E6) is
automaticaly repeated in "StartLunch" (F6) and puts the time that is 1/2
hour later in "EndLunch".

I already have a macro to address the no lunch issue.

Thank you,
Jeff




Jeff

Thanks Bill,
This will work Just fine and I can turn it into a macro now that I
understand how to add and subtract time (that was the main problem.)
I am getting there.
Jeff

"Bill Kuunders" wrote:

no macro's
just an if function

assume A1 is start time entered as 08:00
B1 is end time entered as 16:30
in C1 you enter 0 if no lunch
or for example 1.5 if lunch was longer than 0.5
or you leave it empty for most cases.
enter formula in D1 =IF(C10.5,C1,IF(C1="",0.5,0))
enter formula in E1 =((A1B1)+B1-A1)*24-D1

Regards
Bill K

"Jeff" wrote in message
...
Please help,

I need a VB code for assumed lunch.

=(E6<D6)+E6-D6+(G6<F6)+G6-F6 is the code I am currently using to
calculate
total hours worked per day.
D6 is "StartWork", E6 is "StartLunch", F6 is "EndLunch" G6 is "EndWork".

Our employees do not punch out for lunch unless if they are going to be
longer than 1/2 hour. Otherwise we just assume 1/2 hour or "no lunch" if
they write "no lunch" on their card.

To address the assumed lunch:
What I need is a VB code so that what I enter in "StartWork" (E6) is
automaticaly repeated in "StartLunch" (F6) and puts the time that is 1/2
hour later in "EndLunch".

I already have a macro to address the no lunch issue.

Thank you,
Jeff






All times are GMT +1. The time now is 12:08 PM.

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