View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
cm_gmail[_6_] cm_gmail[_6_] is offline
external usenet poster
 
Posts: 1
Default Time calculations


OK, I would LOVE some help converting this to an Excel function as
opposed to a formula.

The issue I'm having is keeping the logic as simple in the function as
possible to reduce the possibility for error.

A major driving force to do this is the "exceptions" I have to build
in. Weekends are paid at the extra rate without the 08:00-17:00 window
as is holidays, etc. It's easier to build these exceptions into VBA
than in a formula.

The function I have defined before has this interface:
Function shiftBonus(ShiftDate As Date, Optional in1 = 0, Optional out1
= 0, Optional in2 = 0, Optional out2 = 0) As Single

I call it:
=shiftBonus(A5, B5, C5, D5, E5) to get the date (A5) and the 4 times
(B-E5).

Again, Thanks for the help. This formula taught me some good tricks
that I had only applied to sumif and to doing sumif on multiple
criteria. Namely, multiply by 0 (false) or 1 (true) to get the
optional data included.


--
cm_gmail
------------------------------------------------------------------------
cm_gmail's Profile: http://www.excelforum.com/member.php...o&userid=33451
View this thread: http://www.excelforum.com/showthread...hreadid=532590