Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate time differences with a twist

Status
Not open for further replies.
Apr 19, 2000
73
US
I have a subform with the following fields
Time in - format as short time (12:00 AM)
Time out - format as short time (12:00 AM)
Hours - format as a number (2 decimal places)

I need to calculate the difference between Time in and Time out and then populate the Hours field after the user updates the time out field.

The twist is that I need the Hours field to be a number and to calculate the time in tenths of an hour (example: Time in is 1:00 PM and TIme out is 2:30 PM so hours would be 1.5)
 
Works but now every cell in the hours column till the very end of the sheet defaults to 0.0 if nothing is in the time in or time out cells. How do i prevent this?
 
You can use a conditional format. Select all the cells then
Select 'format' then 'conditional format'
if cell value 'is equal to' 0 then click the format button and select white font this will hide all 0's

Jim
 
I don't know if this will be helpful or not, but Excel views blank cells as 0 in calculations. Look at the Microsoft Knowledge Base Article 214244 (XL: How to create a formula to correctly evaluate blank cells) for more info on using the =IF(ISBLANK() formula.

Di
 
Got it!
I selected tools then options then views and under the general tab i unchecked show zero values. That did what I needed without formulas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top