I want 1 not 0.99999999!!

I heart Excel

Board Regular
Joined
Feb 28, 2011
Messages
66
Hello,

My colleagues can select hours off work that then pull through to an index and prints to a virtual printer, using the details in the index.

I seem to have a problem I can't resolve or figure out why!!!

When someone requests -

7.30-8.30 off the total is 1 hour
9.30-10.30 off the total is 1 hour
IF 8.30-9.30 off the total is 0.999999999?! :confused:

WHY?! And is there anyway around this problem? I have checked the formatting and it's the same as all the other cells which work absolutly fine.

Thanks,
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hello,

My colleagues can select hours off work that then pull through to an index and prints to a virtual printer, using the details in the index.

I seem to have a problem I can't resolve or figure out why!!!

When someone requests -

7.30-8.30 off the total is 1 hour
9.30-10.30 off the total is 1 hour
IF 8.30-9.30 off the total is 0.999999999?! :confused:

WHY?! And is there anyway around this problem? I have checked the formatting and it's the same as all the other cells which work absolutly fine.

Thanks,
This is due to what's known as a floating point error.

Understanding IEEE floating point errors...

http://support.microsoft.com/kb/42980

How to correct rounding errors in floating point arithmetic...

http://support.microsoft.com/kb/214118

The solution is to round the result. To round to the nearest minute:

A2 = 8:30
B2 = 9:30

=ROUND((B2-A2)*1440,0)/1440

Format as h:mm
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top