[Solved] Functions with trunc() not returning true values

Occasional Visitor

For example,

If cell A1 = 1.0005 then

=if(A1-trunc(A1,3)=0.0005,1,0) returns 0. 

additionally if I input cell A2=0.0005 and 

Cell A3= A1-trunc(A1,3)

then =A2=A3 returns FALSE. 


Why does excel not recognize difference of the equation as the value 0.0005?

1 Reply
best response confirmed by Spogo9 (Occasional Visitor)


If you change the formula to =A2-A3, you will see that the result is not exactly 0:


This is caused by tiny rounding errors. To avoid the problem, change the formula in A3 to


(We round to 4 decimal places since your numbers have 4 significant decimal places)