Returning a zero

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!
 
J

JE McGimpsey

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.
 

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

Similar Threads

calculate time elapsed inbetween days 3
Time format? 1
Help with formula 1
Excel Sumproduct 0
Dates in excel curiouser and curiouser 1
excel rounding error? 4
How to sum negative times 2
Need help adjusting time 7

Top