View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default If function confused with 0.1

david,

To remove (or maybe add) confusion if I format all cells to 16 decimal
places I see in both E2003 & E2007


a1 1.7000000000000000
b1 1.6000000000000000
C1 0.0999999999999999

So A1 & b1 are truly 1.7 & 1.6.

Mike

"David Biddulph" wrote:

Which version of Excel are you using, Mike? With Excel 2003, 1.7-1.6 gives
me 0.100000000000000 if I format to 15 decimal places, so I am confused as
to how you are seeing the figure you quote for 9 decimal places (or even 7
as you have shown). I wonder whether you (and the OP) are getting confused
by starting with numbers that aren't 1.7 and 1.6 (or the closest fixed point
binary representations thereof). Are they the result of calculations? What
do you see if you expand them to 15 decimal places? And what if you retype
1.7 and 1.6?

It is, of course, true that there is no exact binary representation of 1.7,
1.6, or 0.1.
--
David Biddulph

"Mike H" wrote in message
...
Chris,

It's all to do with the way Excel does arithmetic. If you do you sum
1.7-1.6
and expand the formula cell to 9 decimal places you'll see the answer
comes
out as 0.0999999 and while that may seem odd it entirely meets the IEEE
standard for floating point arithmetic.

Have a look here for a full explanation

http://support.microsoft.com/default.aspx/kb/78113

Now to your proble, try this

=IF(ROUND(C1,1)=0.1,"yes","no")

Mike



"Chris B" wrote:

Hi,

I have set up the following If function to determine if the answer to a
simple subtraction of two decimal numbers is 0.1.

=IF(C1=0.1,"yes","no")

The calculation is merely C1=A1-B1

However, for some calculations it is giving the answer "no" when the
answer
is clearly 0.1!

1.7-1.6 gives a no response as does 1.4-1.3. Interestingly, from 4.1-4
all
answers are no!

Hope someone can help
Cheers




.