Returning a zero

  • Thread starter Thread starter MikeG0930
  • Start date Start date
M

MikeG0930

I have a formula that calculates hours and subtracts .5 hours for
lunch. This is the formula:

=SUM((C7*24)-(B7*24))-0.5

The problem is, if I don't have a time entered into the respective
cells, the total hours always shows as -.5
I would like the total hours to show as zero until time is entered.

Thanks!
 
One way:

=IF(COUNT(B7:C7)=2,(C7-B7)*24-0.5,0)

Note that your SUM() function is superfluous.

Another:

=IF(COUNT(B7:C7)=2,MOD(C7-B7,1)*24-0.5,0)d

which will take into account periods that span midnight.
 
Back
Top