View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sandy Sandy is offline
external usenet poster
 
Posts: 270
Default Time difference calculation

Hi

Excel 2003

In C5 i have a start time eg 12.30pm and in D5 I have a finish time eg
20.45pm.

I need to calculate the hours and minutes worked in E5, with a minimum of 1
hour. In other words if 45mins is worked then 1 hour is returned, but
anything greater than 1 hour will be as is.

This nearly works, but if the start time is say 10pm and finish is next day
at 6am then it fails.
=IF(D5-C5<=TIME(1,0,0),TIME(1,0,0),IF(D5<C5,D5+1,D5)-C5)

I have tried to incorporate (D5<C5,D5+1,D5)-C5) into the first part of the
function but I cannot get it to work.

All assistance gratefully received.

Sandy