Conditional Formatting shows wrong color!

brncao

Board Regular
Joined
Apr 28, 2015
Messages
147
It worked previously, but all of a sudden it's showing the wrong color. Before you ask, there are no percentages and fractions. Just additions and subtractions of cash. I'm trying to do this: if A = B, shade with light green fill with dark green text; if A <> B, shade with light red fill with dark red text.

But... when A = B, I'm getting a light red fill and dark red text. Why? A <> B works fine.

I'm just staring at the Conditional Formatting Rules Manager and can't wrap my mind around this.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
They're numbers.

I found the culprit. The calculated cell is, in reality, $71,571.0799999998, which is not equal to $71,571.08. What the hell? There's only two decimal places and I'm just doing basic adding and subtracting. What's going on?
 
Upvote 0
They're numbers.

I found the culprit. The calculated cell is, in reality, $71,571.0799999998, which is not equal to $71,571.08. What the hell? There's only two decimal places and I'm just doing basic adding and subtracting. What's going on?
71123.13
1445000
1444552.05
=A1+A2-A3

<tbody>
</tbody>
Remember to increase decimal places.
 
Upvote 0
Whenever i do conditional formatting i usually avoid this by "locking" the ranges say for example you are doing 1 criteria 0-10 and second criteria 11-20 and a third one 21 and over

i do between 0 to 10.0000001

then between 11 to 20.0000001

then lastly

between 21 - 1000000000000


or something along those lines depending on the scnenario

Juuuuuust to make sure
 
Upvote 0
They're numbers.

I found the culprit. The calculated cell is, in reality, $71,571.0799999998, which is not equal to $71,571.08. What the hell? There's only two decimal places and I'm just doing basic adding and subtracting. What's going on?
As you have discovered, Excel has 15-digit precision so when comparing number A to number B even though they may appear to be equal when viewing the cells they are in, if they are not equal out to the limit of Excel's precision then A=B is false. Better to use something like Round(A,2) = Round(B,2) to handle CF for number comparisons.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,877
Members
449,056
Latest member
ruhulaminappu

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