View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default EXCEL GURU WANTED - Time calculations

On Wed, 26 Dec 2007 13:16:00 -0800, Robert
wrote:

Problem is when taking a time-start cell from a time-end and applying a rate
to the hours I get a different value from doing a simple calculation.

ie
simple calculation is
1.17 hours @ £130/hour = £152.10

Using times as
Start Cell E2 = 13:00 & Cell D2 End 14:10

Calculating as:
((E2-INT(E2))*24)-((D2-INT(D2))*24)
results as £1.17

Difference is 0.43?

I have tried other calculations e.g. hour(d2) + minute(d2)/60) etc

I am quite baffled can anyone help!

If this 1.17 is used in the calculation the result is
151.67




Problem is that

14:10 - 13:10 = 70 minutes.

70/60 = 1.16666666666667 (to Excel's level of precision.

Since 1.7 is NOT equal to 1.16666666666667 your results cannot be the same.

The 1.16666666666667 is mathematically more correct than 1.17.

Since we don't know what the office policies are, I don't know which would be
more correct for your office.

If maximum precision is an issue, then 151.67 is correct.

If your office policy is that "all times will be rounded to the nearest 100th
of an hour" then the 152.10 is correct.

To implement that policy, you could use the formula:

=ROUND((EndTm-StartTm)*24,2) * Hourly_Rate





--ron