# Thread: Excel miscalculation in IF formula (XP)

1. ## Excel miscalculation in IF formula (XP)

I have a simple worksheet that seems to be calculating something incorrectly by a very small amount. I simply have a formula to check if the sum of the totals in columns G and H equal the sum of column F. I tried two formulas that that should theoretically return the same result but they don't.
Forumla 1: =IF((E30-F30-G30)=0,"okay","not okay")
Formula 2: =IF(E30=F30+G30,"okay","not okay")

Forumla 1 returns "not okay". When I evaluate the formula, the result of the first part of the formula is -7.23 E-12. When I remove it from the if statement, it returns zero. Any thoughts on why this happens? The file is attached.

Thanks,
Terry

2. ## Re: Excel miscalculation in IF formula (XP)

See Chip Pearson's site. Though the article refers to Excel 97 it also applies to your version.

You could use the ROUND funtion within the IF function to overcome this problem.
Forumla 1: =IF(ROUND((E30-F30-G30),3)=0,"okay","not okay")

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•