I am using this formula to calculate hours worked:
=IF((AND(DateBegan<>"",DateEnded<>"")),ROUND(MULT((SUB((ADD(DATEVALUE(DateEnded),TIMEVALUE(DateEnded))),(ADD(DATEVALUE(DateBegan),TIMEVALUE(DateBegan))))),24),2),"")
The customer would like to add another element, namely the ability to deduct a 30 or 60 minute lunch break. I created radio buttons for the lunch choices, then a hidden field to show either 0, 0.50, or 1.00:
Then I very inelegantly tried to tack on the subtraction of the Lunch_Time variable to the formula:
=IF((AND(DateBegan<>"",DateEnded<>"")),ROUND(MULT((SUB((ADD(DATEVALUE(DateEnded),TIMEVALUE(DateEnded))),(ADD(DATEVALUE(DateBegan),TIMEVALUE(DateBegan))))),24),2),"")-Lunch_Time
When entering the date/time info, I get a calculation error UNTIL I enter the time ended, then the error goes away and everything works.
How can I fix the formula to get rid of the error?
Thank you.