Conditional Formatting shows wrong color!

brncao

Board Regular
Joined
Apr 28, 2015
Messages
141
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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,913
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Are A & B numbers or text?
 

brncao

Board Regular
Joined
Apr 28, 2015
Messages
141
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?
 

brncao

Board Regular
Joined
Apr 28, 2015
Messages
141
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.
 

deletedalien

Well-known Member
Joined
Dec 8, 2008
Messages
505
Office Version
  1. 2013
Platform
  1. Windows
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
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,913
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,503
Messages
5,837,717
Members
430,512
Latest member
sciplants

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
Top