# Thread: Time formula problem

1. Good morning

I have problems with a formula and would appreciate some help

I have 2 columns both formatted as [h]:mm the 3rd has the formula I2-J2 and is also formatted as [h]:mm which is fine if the time in I2 is higher than J2 but returns #### if I2 is less than J2. I have read through Chip Pearsons site Date Arithmatic which shows this

"Time Intervals

You can determine the number of hours and minutes between two times by subtracting the two times. However, since Excel cannot handle negative times, you must use an =IF statement to adjust the time accordingly. If your times were entered without a date (e.g, 22:30), the following statement will compute the interval between two times in A1 and B1 .

=IF(A1>B1,B1+1-A1,B1-A1)

The "+1" in the formula causes Excel to treat B1 as if it were in the next day, so 02:30-22:00 will result in 4:30, four hours and thirty minutes, which is what we would expect. To covert this to a decimal number, for example, 4.5, indicating how many hours, multiply the result by 24 and format the cell as General or Decimal, as in

=24*(IF(A1>B1,B1+1-A1,B1-A1))"

So I have entered this =24*(IF(I2>J2,J2+1-I2,J2-I2)) the time in I2 = 48:00 and J2 = 44:10 but with the target cell formatted as [h]:mm I get a result of 484, If I format it as General I get 20.166 recurring and if I format it as Number I get 20.17?

The examples in the graphic below show my original formula in L and Chip's in M

Any ideas please

2. 1. Chip Pearson's formulas are intended for clock time, not for cumulative time.
2. The result of the formula, as explicitly stated, is the number of hours converted to a decimal number, so you shouldn't format it as time.

Try this formula instead:

=24*(J2-I2)

and format the result as General or as Number with the desired number of decimal places.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•