Forum Discussion
MOD function
when I use MOD I face this result
MOD(3,0.9)= 0.3 Great result
MOD(3,0.2)= 0.2 Wrong result
MOD(3,0.2) should be 0.00
this is by Identification
and by the MS published syntax
and as per GOOGLE sheets result
I contacted MS Support and a nice person gave me wrong answer, saying that I have to change my Excel to show results in 0 digits instead of the default 2 digits, !!!!! then the MOD(3,0.9)= 0.3 will be wrong it will be 0 while its 0.3
clear MS Support Person tried just to imagine a solution but it went far
however if you have an explanation let me know
3 Replies
- SergeiBaklanDiamond Contributor
That is due to floating point error (https://support.microsoft.com/en-us/help/78113/floating-point-arithmetic-may-give-inaccurate-results-in-excel). Using MOD with non-integer as second parameter is not reliable, better to use equivalent combination with INT or scale all numbers in MOD to integers.
- AMR_BEN_KHADRACopper Contributor
SergeiBaklanthank you, that is fair enough
- SergeiBaklanDiamond Contributor
AMR_BEN_KHADRA , you are welcome