IF statement evaluating with rounding error

henryg

Board Regular
Joined
Oct 23, 2008
Messages
152
Office Version
  1. 365
Platform
  1. Windows
I have the sum of a column which evaluates to 2 decimal places exactly, but when referenced in a IF formula it evaluates with many/multiple decimal places, ie Excel is introducing a rounding error.

So, say, A6=sum(A1:A5) evaluates to 21.75 exactly, in my IF(A6<>G7...) formula it would evaluate to 21.749999.

It took me a while to realise I had to round the sum formula to get rid of the problem, but how can a formula evaluate to different values directly as compared to when referenced?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
It's more likely a formatting issue, try going intot he Format Cells dialogue and make sure each cell is formatted the same, first display 5 numbers after the decimal then just 2, your answers should be identical. The other thing to try is on the resluts of both cells, in another cell =Result1=Result2 and if it evaluates to FALSE then there's another issue
 
Upvote 0
It's more likely a formatting issue, try going intot he Format Cells dialogue and make sure each cell is formatted the same, first display 5 numbers after the decimal then just 2, your answers should be identical.
All formats are the same, and each individual summed value has only 2 decimal places or is rounded to 2. There are no values after the point to 20 places.

The other thing to try is on the resluts of both cells, in another cell =Result1=Result2 and if it evaluates to FALSE then there's another issue
The only FALSE value is given if I take away the rounded sum.

I didn't know about this == method, so the problem is worth it just for the education. :laugh:


Henry
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,908
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top