Forum Discussion
Excel shows an incorrect answer
- Mar 14, 2022
Perhaps it is a rounding error. What is the result if you change the formula to
=IF(ROUND(N15-N44,4)=0,"ok","oops")
For the test to be meaningful both N15 and N44 need to be integers. Otherwise the result will depend upon minute rounding errors that are an inherent property of all computer calculations. A standard approach is to test
= IF(ABS(N15-N44)<eps, "OK", "Oops")
where 'eps' is larger than any likely rounding error but very small relative to N15 and N44. Something you should not do, is to round the values themselves because this will simply introduce new errors that could swamp your calculations.
- Ramakrishnan RukminiMar 15, 2022Copper Contributor
The different answer is because, excel accurately compares the values up to 14 decimal points (floating point values). Any calculation (floating point calculation) in excel gives solution upto 14 decimal accuracy. Hence the solution (you require) lies in the accuracy you specify for comparison. I have made a video explaining the same. Hope this helps in understanding excel better. Cheers. Ramakrishnan V
https://youtu.be/ikp66l_54JA