Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2012, 12:32 AM
mashley mashley is offline IF formula returns wrong result Windows 7 32bit IF formula returns wrong result Office 2007
Novice
IF formula returns wrong result
 
Join Date: Sep 2012
Posts: 3
mashley is on a distinguished road
Default IF formula returns wrong result

Hi - I'm stumped by this problem ... Excel 2007 on Win7 Pro 32

I have a simple test: =IF(G262=J265,"OK","ERROR")

My problem: both G262 and J265 contain the value 8805.13, but instead of OK, I get ERROR!

G262 gets its value from a sum =SUM(G2:G261)

J265 gets its value from an addition: =E262+F262+I262+J262

I have ensured all fields have the same format (was currency, tried number, made no difference).

I have also tried forcing for Value (e.g. IF(VALUE(G262)=VALUE(J265),"OK","ERROR") but that makes no difference.

But, if I manually type 8805.13 in G262, the IF works as it should!!!

What is going on here???
Reply With Quote
  #2  
Old 09-07-2012, 12:45 AM
mashley mashley is offline IF formula returns wrong result Windows 7 32bit IF formula returns wrong result Office 2007
Novice
IF formula returns wrong result
 
Join Date: Sep 2012
Posts: 3
mashley is on a distinguished road
Default

OK, I have found that if I evaluate the formula, I can see that

G262 gets a value of 8805.1300000000001 while J265 is 8805.13.

But stepping into the evaluation, SUM(G2:G261) = 8805.13, yet this is fed to the IF as 8805.1300000000001.

What is going on here?
Reply With Quote
  #3  
Old 09-07-2012, 01:06 AM
mashley mashley is offline IF formula returns wrong result Windows 7 32bit IF formula returns wrong result Office 2007
Novice
IF formula returns wrong result
 
Join Date: Sep 2012
Posts: 3
mashley is on a distinguished road
Default

OK, there is more. Even though the sum if of numbers with only two decimal places, the sum itself is 8805.13000000001 !!!

So the only way I can get a correct result is by using TRUNC(SUM(G2:G261),2).

Weird, as I have several worksheets all very similar, but only this one produces this odd result.

Thanks Bill!!!
Reply With Quote
  #4  
Old 09-07-2012, 07:03 AM
NBVC's Avatar
NBVC NBVC is offline IF formula returns wrong result Windows 7 64bit IF formula returns wrong result Office 2007
The Formula Guy
 
Join Date: Mar 2012
Location: Mississauga, CANADA
Posts: 215
NBVC will become famous soon enoughNBVC will become famous soon enough
Default

have a read here to understand what is happening....


http://www.cpearson.com/excel/rounding.htm
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF formula returns wrong result How to release hard returns? markg2 Word 13 05-08-2023 01:38 PM
Convert Formula Result to Static Text MYGS Excel 16 01-21-2013 08:18 AM
IF formula returns wrong result No tabbing, no returns in forms? rdowney1 Word 7 06-29-2012 08:35 AM
Can I create a formula that will show result in the same cell and let me copy it down CranstC Excel 1 02-11-2012 01:29 AM
IF formula returns TRUE instead of evaluating COUNTIF ColinC Excel 4 12-28-2011 08:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft