Thread: roster
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PaulD PaulD is offline
external usenet poster
 
Posts: 92
Default roster

"Greg Brow" wrote in message
...
: I have asked this before but I am looking to have a spreadsheet that will
: calculate the hours worked minus their meal breaks. I would like to do 2
: things:
:
: 1st one is :
:
: We work more than 5 hours we need to have a 30 minute meal break, If we
: work more than 8 hours we have to have an hour.
:
: Can i make a macro that will calculate this automatically.

yes you can use a macro, but how about a formula
assuming this is pasted in cell D6

=IF((C6-B6)*24<5,(C6-B6)*24,IF((C6-B6)*248,(C6-B6)*24-1,(C6-B6)*24-0.5))

:
: part 2:
:
: Is it possible to make excel not show the results unless the work times
have
: been inserted into cells b3 and c3.
:
<snip

yes, add an "isblank" check in the formula
again assuming this is pasted in cell D6

=IF(ISBLANK(C6),"",IF((C6-B6)*24<5,(C6-B6)*24,IF((C6-B6)*248,(C6-B6)*24-1,(
C6-B6)*24-0.5)))

If you then protect the spreadsheet and hide formulas, no one will know what
is going on :)
Of course the trouble I always have with this is users inserting rows. If
you have this trouble them perhaps a macro using the change event is more in
order for you.
Paul D