Conditional Formatting

Tam12

New Member
Joined
Mar 12, 2024
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have set up a conditional formatting to do a check, if the values match to display a tick, if not to display a cross.

As you can see the values match, however it is displaying a cross.

The formula is:

=IF(K4=K5,CHAR(252),CHAR(251))

1710253760649.png


Thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Welcome to the Board!

I suspect a rounding issue. Try using:
Excel Formula:
ROUND(K4,2)=ROUND(K5,2)
instead to weed out that issue.
 
Upvote 0
I have 365 and I can't seem to select the Webdings font in the conditional formatting set up dialog to change the font.

If you are really using Conditional Formatting, your result needs to evaluate to TRUE or FALSE, so having CHAR(252) or CHAR(251) in a CF formula will not give you the desired results. (This is my guess why @Joe4 did not give you an IF() function with the rounding suggestion.). I'm not sure if a text value of Char(252) or Char(251) resolves to TRUE or FALSE, but you'll always get the same one of the two in any CF evaluation.
 
Upvote 0
Welcome to the Board!

I suspect a rounding issue. Try using:
Excel Formula:
ROUND(K4,2)=ROUND(K5,2)
instead to weed out that issue.
Hi,

Thanks for your welcome and your reply!

Unfortunately, this did not work. And just as an fyi, the numbers it is checking against are formulated. I checked all the formulas and the figures it is pulling from do not have multiple decimals. Just the -3415.54 displayed...
 
Upvote 0
I have 365 and I can't seem to select the Webdings font in the conditional formatting set up dialog to change the font.

If you are really using Conditional Formatting, your result needs to evaluate to TRUE or FALSE, so having CHAR(252) or CHAR(251) in a CF formula will not give you the desired results. (This is my guess why @Joe4 did not give you an IF() function with the rounding suggestion.). I'm not sure if a text value of Char(252) or Char(251) resolves to TRUE or FALSE, but you'll always get the same one of the two in any CF evaluation.
The font I am using is 'Wingdings'

I have used conditional formatting without having TRUE or FALSE before and achieved the desired results...
 
Upvote 0
Excel Formula:
=IF(K4=K5,CHAR(252),CHAR(251))
Is a valid spreadsheet formula, but NOT a Conditional Formatting formula.
As awoohaw said, Conditional Formatting formulas must return TRUE or FALSE.
So, if you wanted to return two different format options, depending on the result, you would need two different rules formulas:

Rule 1 (equal):
Excel Formula:
=ROUND(K4,2)=ROUND(K5,2)
and then choose your desired formatting option

Rule 2 (not equal):
Excel Formula:
=ROUND(K4,2)<>ROUND(K5,2)
and then choose your desired formatting option

Also note:
And just as an fyi, the numbers it is checking against are formulated. I checked all the formulas and the figures it is pulling from do not have multiple decimals. Just the -3415.54 displayed...
That does not matter, you could STILL have issues, as explained here: Floating-point arithmetic may give inaccurate result in Excel - Microsoft 365 Apps
Adding the ROUND function ensures that this won't be an issue (and even if it is not needed in this case, it doesn't hurt anything).
 
Upvote 1
Solution
Just the -3415.54 displayed...
Displayed does not mean what the value that is stored in the cell is.
Change the cell formatting you have in the 2 cells to general with all the decimal spaces you can, and you may eventually see a difference.
 
Upvote 1
Excel Formula:
=IF(K4=K5,CHAR(252),CHAR(251))
Is a valid spreadsheet formula, but NOT a Conditional Formatting formula.
As awoohaw said, Conditional Formatting formulas must return TRUE or FALSE.
So, if you wanted to return two different format options, depending on the result, you would need two different rules formulas:

Rule 1 (equal):
Excel Formula:
=ROUND(K4,2)=ROUND(K5,2)
and then choose your desired formatting option

Rule 2 (not equal):
Excel Formula:
=ROUND(K4,2)<>ROUND(K5,2)
and then choose your desired formatting option

Also note:

That does not matter, you could STILL have issues, as explained here: Floating-point arithmetic may give inaccurate result in Excel - Microsoft 365 Apps
Adding the ROUND function ensures that this won't be an issue (and even if it is not needed in this case, it doesn't hurt anything).
Makes sense,

All working now thank you!
 
Upvote 0
Displayed does not mean what the value that is stored in the cell is.
Change the cell formatting you have in the 2 cells to general with all the decimal spaces you can, and you may eventually see a difference.
Understood,

Thanks for your help!
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,224,889
Messages
6,181,606
Members
453,055
Latest member
cope7895

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