Assumed Lunch

J

Jeff

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
 
B

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(C1>0.5,C1,IF(C1="",0.5,0))
enter formula in E1 =((A1>B1)+B1-A1)*24-D1

Regards
Bill K
 
J

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top