Mar 14 2022 03:43 PM
Excel is showing an incorrect answer. I have a simple formula: =IF(N15=N44,"ok","oops") Accordingly, if the number in cell N15 is the same as the number in cell N44, the answer should be "ok." However, it is not. Even if when the numbers in the two cells are exactly the same, the answer is "oops."
This problem has persisted since a previous version of Excel (I recently updated it, but the problem continues).
Further information: when I use the Formula Builder to enter the formula, whatever cell number I put in after the = sign is red in color. Here, the N44 is red. However, if I reverse the numbers and put in N44=N15, the N15 would be red.
There are no other error messages and there are no circular references. N15 is an input number. N44 is the sum of two other cells (neither of which refer to N15).
What the heck is going on?
Mar 14 2022 04:02 PM
SolutionPerhaps it is a rounding error. What is the result if you change the formula to
=IF(ROUND(N15-N44,4)=0,"ok","oops")
Mar 14 2022 04:24 PM
Mar 14 2022 04:29 PM
Mar 14 2022 04:35 PM
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.
Mar 14 2022 06:22 PM
Mar 14 2022 08:18 PM
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