Why is a cell reading as 0.80000001 when it should be 0.8?

Academic_Data

New Member
Joined
Sep 8, 2014
Messages
13
I have a formula that is doing a simple subtraction between two cells. The result of this is being used in a Index(Match) function, but I am sometimes pulling an error because the cell seems to be reading as 0.800000000000001 instead of 0.8. The subtraction in question is just essentially 10.8 - 10. I checked that there are no hidden decimals in the 10.8 and the 10, and there are not.

Any ideas why this is occurring and what I can do to fix this?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Computers work in binary, not decimal, so it's as close to .8 as it can get using subtraction in binary.
You can get around this by using the ROUND function, something like =ROUND(A1-A2,3)
 
Upvote 0
I have a formula that is doing a simple subtraction between two cells. The result of this is being used in a Index(Match) function, but I am sometimes pulling an error because the cell seems to be reading as 0.800000000000001 instead of 0.8. The subtraction in question is just essentially 10.8 - 10. I checked that there are no hidden decimals in the 10.8 and the 10, and there are not.

Any ideas why this is occurring and what I can do to fix this?

Look up on floating point maths, etc.

In the meantime use, something like:

MATCH(TRUNC(A1*10)/10,MatchRange,MatchType)
 
Upvote 0

Forum statistics

Threads
1,203,515
Messages
6,055,844
Members
444,828
Latest member
StaffordStag

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