Color Excel IF Formula Results with Conditional Formatting
Question details
Apply conditional formatting to cells containing IF formula results so that OK displays in blue and ERROR displays in red.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user uses an IF formula, such as =IF(A1=B1,"OK","ERROR"), and wants the returned text to receive automatic color formatting.
- Observed behavior
- Formula result cells should show OK in blue and ERROR in red based on their displayed values.
Confirm that the IF formula already returns consistent text values, such as OK and ERROR, with no extra spaces. Select only the formula result cells before creating the formatting rules.
Create separate conditional formatting rules for OK and ERROR
Use this method when the result cells display text returned by an IF formula and each result needs its own font color.
Conditional formatting evaluates the displayed value in each selected result cell. Your IF formula can remain unchanged while Excel applies the colors automatically.
Select the cells that contain the IF formulas, for example C2:C100, where each cell returns OK or ERROR.
On the Home tab, select Conditional Formatting > Highlight Cells Rules > Equal To. Enter "OK", choose Custom Format, set the Font color to blue, and select OK.
With the same range selected, choose Home > Conditional Formatting > Highlight Cells Rules > Equal To. Enter "ERROR", choose Custom Format, set the Font color to red, and select OK.
Select Home > Conditional Formatting > Manage Rules and confirm that both rules apply to the intended result-cell range, such as =$C$2:$C$100.

Use formula-based rules when the result cells need more flexible conditions
Use this option when the formatting depends on a condition beyond an exact displayed value, or when you need to apply a rule across a larger table.
Color IF Results Automatically in WPS Spreadsheets
WPS Spreadsheets lets you use the same IF formula logic and conditional formatting rules to color returned text such as OK and ERROR. Create value-based rules from the Home tab, choose font colors, and let WPS update the formatting as worksheet values change.
- 1. Open the worksheet in WPS Spreadsheets: Open the Excel workbook in WPS Office and select the cells containing the IF formula results.
- 2. Create the OK formatting rule: Go to Home > Conditional Formatting > Highlight Cells Rules > Equal To, enter OK, and set the font color to blue.
- 3. Create the ERROR formatting rule: Create another Equal To rule from Home > Conditional Formatting, enter ERROR, and set the font color to red.
- 4. Review the applied range: Open Home > Conditional Formatting > Manage Rules to confirm both rules cover all formula result cells.

Frequently Asked Questions
Can conditional formatting color text returned by an IF formula?
Yes. Select the cells containing the IF results, then create conditional formatting rules based on the cell value being equal to text such as "OK" or "ERROR".
Why does my OK rule not apply to the formula result?
Check that the rule text exactly matches the formula output, including spaces and capitalization. Also open Home > Conditional Formatting > Manage Rules and verify the Applies to range includes the formula cells.
Do I need to change =IF(A1=B1,"OK","ERROR") to use colors?
No. Leave the IF formula as it is. Conditional formatting changes the appearance of the returned value without modifying the formula.
How do I change an existing conditional formatting color in Excel?
Select a formatted cell, go to Home > Conditional Formatting > Manage Rules, select the relevant rule, choose Edit Rule, then select Format to choose a different font color.




