Thread: Time Format
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph[_2_] David Biddulph[_2_] is offline
external usenet poster
 
Posts: 8,651
Default Time Format

As with so many posts on this group, you haven't included enough detail in
the question, nor does your example make it clear.
How do you do the rounding at each end of the working day? To units of an
hour, or half an hour, or a quarter of an hour?
Do you round to the nearest unit, or does the employee always lose out on
the rounding at each end of the working day?
Do you want a result as an Excel time, or as decimal hours? [In other
words, would you want 8:30 or 8.5?]
Can the time worked span midnight?
Do you need the formula to return a blank in cases where you haven't yet
filled in times for IN and OUT?

Once you've sorted out the question, the answer will probably be relatively
easy.
Making a guess at some of the answers, you may want something like:
=IF(OR(B2="",C2=""),"",FLOOR(C2*24,0.25)-CEILING(B2*24,0.25))
--
David Biddulph

"yclhk" wrote in message
...
I'd like to create a excel file to calculate the hours worked.
Col A Col B Col C Col D
Date Time IN Time OUT hrs worked

in col B, record Time IN 7:53am
in col C, record Time OUT 6:05pm
However, 7:53am expects to count as 8:00am &
6:05pm count as 6:00pm, and hours worked results as 10 hours

I wish to keep the records of the Time IN & OUT in the actual time and
how to set the formula to calculate in form of the expected result in col
D ?