Excel cannot subtract???
Computers do math in binary, not decimal. The only 2-figure decimal
fractions that can be exactly represented in binary are 0.00, 0.25,
0.50, and 0.75. All other 2-figure decimal fractions must be
approximated in binary (just as 1/3 must be approximated in decimal).
When you do math with approximate inputs, it sould not be surprising
when the output is only approximate.
Instead of IF(A5=B5, ... use IF(ROUND(A5,2)=ROUND(B5,2), ... or
equivalently IF(ROUND(A5-B5,2)=0, ... to avoid detecting slight
differences due to accumulated discrepancies due to binary approximations.
Alternately, if you did your calculations in pennies (7505 instead of
75.05), then no approximations would be involved, and you would get the
results that you expected.
Jerry
blakrapter wrote:
Thanks for the reply. I am using fractions to 2 decimal places, but I
am not multiplying or dividing, so it should always be no more than 2
decimal places with no rounding issues. Now, if the "IF" function has
issues with anything other than whole numbers, it could cause a
problem, BUT, the value to the subtraction is always 0.00, so even
though the subtraction deals with cents, the result is a whole number.
Also, I tried using a cell that contained the difference in two
numbers. It was something like $75.05 (difference in principals
mentioned eariler) The forumula was in say cell A5 and then I put
"=A5" in cell B5. Then when I used the IF function as IF(A5=B5, "yes",
"no") it worked... It really does sound like a rounding error with
something in the .00000001 place or something off, but i cannot be
because I am just adding and subtracting currency values that I put
in...
Any ideas?
Thanks
|