Page 1 of Excel can`t subtract ??

PCs & Mobiles Forum

Excel can`t subtract ??

stephen harris (Competent) posted this on Friday, 9th January 2004, 18:06

I was doing some Excel spreadsheets for work and one of our test needs a particular value to be less than or equal to a difference between two numbers.
These are typically in the 3000 to 800 range to 2 decimal places e.g. 3060.03 and 3060.45 the difference is supposed to be greater than or equal to 0.42.
So why, when I enter this into Excel, does it tell me that the difference is LESS than 0.42, and in fact on expanding the answer to 13 decimal places does it suddenly change from 0.42 to 0.4199999999996 !!! which it obviously isn`t.
The numbers have been entered in general format and only to 2 dp.
Any ideas folks !!
BTW we have reported this to Microsoft and await their answer with interest.

RE: Excel can`t subtract ??

fergus4 (Mostly Harmless) posted this on Friday, 9th January 2004, 20:01

I`ve had this too. Strange. You can get around it by using the ROUND function to 2dp.

eg: =if(round(A1-A2,2)<=0.42,"true","false")

HTH

fergus

This item was edited on Friday, 9th January 2004, 20:06

Go back to PCs & Mobiles Forum threads, or All Forum threads