Originally Posted by
Baconfish
When I do this calculation: FLOOR.MATH(564,3-FLOOR.MATH(564,3;1);0,1) I would expect the formula to return 0,3, but it actually returns 0,2.
[....]
If instead I'm using the approximated match with the VLOOKUP, then the formula would only need to look like this:
564,3-FLOOR.MATH(564,3;1)
then the match would take care of the ounding, but I am unsure whether or not the error occurs here to be honest.
Does anyone have an idea as to how I can get around this annoying, erratic error?
Note: I use period for the decimal point, where you use comma; and I use comma to separate parameters, where you use semicolon. Moreover, my version of Excel only has FLOOR; but I believe that is the same as FLOOR.MATH as you use it.
Yes, that is probably at least one source of your problems. Honestly, I am not bothering to look at anything else.
You seem to want to "extract" the fractional part of a value, rounded to 1 decimal place. Am I correct?
If so, a simpler formula is:
=ROUND(MOD(564.3,1),1)
First, note that 564,3-FLOOR.MATH(564,3;1) only appears to be 0.3. If that formula is in A1, note that =A1=0.3 return FALSE(!).
In any case, even it worked, it would be by coincidence. In other words, it might not work for other values.
There are two issues....
First, most decimal fractions can only be approximated in 64-binary floating-point, which Excel uses to store numeric values. Moreover, the approximation depends on the magnitude of the integer part. For example, the exact value is on the right:
Here, I use period for the decimal point, and comma to demarcate the first 15 significant digits, which is all that Excel displays and formats, an arbitrary limitation.
Note the difference in the approximations of 0.3 (3/10).
So in general, when we expect a calculation to be accurate to n decimal places, we should explicitly round to that number of decimal places. (Not to an arbitrary number of decimal places like 10, as some people suggest.)
Second, because of these approximations, FLOOR(.MATH) is unreliable when the second parameter is a decimal fraction (unless it is an exact power of 2).
Bookmarks