Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / March 2008

Tip: Looking for answers? Try searching our database.

formula not working right

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
justlearnin - 12 Mar 2008 19:21 GMT
I have a formula in my spreadsheet that check a balance.
=IF(SUM(C17:H17)=I17,"OK", "ERR")
Here are the values that are in each cell
C17 104.86
D17 58.32
E18 -209.11
F19 0
G19 0
H19 52.78
I17 6.85
I get "ERR" because when I evaluate K17 where the formula is it gives me
6.84999999999999. I have tried everything I can think of to fix this with no
luck. I even tried a new spreadsheet with the values and fromulas with no
luck (I did not use copy and paste to get the info to the new sheet, typed it
all in)
Please help
Phil H. - 12 Mar 2008 19:47 GMT
If the cells values listed (i.e. C17 and H17) are functions of other numbers
(i.e. C17 is actually "=SUM(C15:C16)") and the formatting of these cell
display a numerical value of only 2 decimal places the function will still
use the unrounded numbers.

Example
C15 = "4.862"
C16 = "100.00"
C17 = "SUM(C15:C16)"

If the above was True the Sun of the fields is 104.862
However if the formatting for C17 was set for only 2 decimal places if will
display 104.86 as you have provided below.
Now if you use the C17 Cell in an equation as you are it will still use the
104.862, there for throwing the math off to not use the exact value.

> I have a formula in my spreadsheet that check a balance.
> =IF(SUM(C17:H17)=I17,"OK", "ERR")
[quoted text clipped - 12 lines]
> all in)
> Please help
Tyro - 12 Mar 2008 20:04 GMT
The formula is working fine. You're experiencing problems with numbers.
Computers generally store numbers as floating point in binary, base 2 which
are approximations of decimal numbers, base 10. Some numbers in decimal can
be represented exactly in binary and others cannot. There are many articles
concerning floating point. Google IEEE floating point.
You can address your problem by rounding the numbers or computing the
difference as less than something like 0.000000001 to determine equality
Modern computers don't work in decimal. Older ones did and did not have this
problem. Progress, I guess.

Tyro

>I have a formula in my spreadsheet that check a balance.
> =IF(SUM(C17:H17)=I17,"OK", "ERR")
[quoted text clipped - 14 lines]
> all in)
> Please help
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.