How to Fix Excel Conditional Formatting Formulas for Correct and Incorrect Selections
Question details
The user needs to set up conditional formatting rules using custom formulas to highlight correct answers in green and incorrect answers in red based on a specific text marker and score comparisons.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating an automated tracking or grading worksheet where cells need to dynamically change color based on the presence of a specific marker and numerical score logic.
- Observed behavior
- The goal is to accurately color-code target cells by determining if a 'P' marker exists and comparing relevant score sums using conditional formatting.
Verify that your worksheet data is structured consistently, as custom conditional formatting formulas rely heavily on exact relative and absolute cell references to function properly across a range.
Use ISNUMBER and XMATCH for Custom Conditional Formatting
Apply a custom formula rule to highlight cells based on complex criteria involving text markers and sum comparisons.
When dealing with complex conditions, standard formatting rules may not be enough. By using the 'Use a formula to determine which cells to format' option, you can leverage functions like ISNUMBER, XMATCH, and SUM to apply highly specific rules.
Highlight the complete range of cells you want the formatting applied to, for example, C3:I18. Ensure you know the exact top-left cell of your selection, as the formula will be based on it.
Go to the Home tab on the ribbon, click 'Conditional Formatting', and select 'New Rule'. Choose 'Use a formula to determine which cells to format'.
In the formula bar, input: =ISNUMBER(XMATCH("P",A3:C3))*(SUM(C3:E3)>SUM($E3,$I3)/2). Click 'Format', select a green fill under the Fill tab, and click OK.
Repeat the process by clicking 'New Rule' again. Enter the formula: =ISNUMBER(XMATCH("P",A3:C3))*(SUM(C3:E3)<=SUM($E3,$I3)/2). Click 'Format', choose a red fill, and apply the rule.

Easily Apply Conditional Formatting in WPS Spreadsheet
WPS Spreadsheet offers a highly compatible and intuitive interface for managing complex conditional formatting. You can easily use advanced formulas to format your data without any hassle.
- 1. Open your worksheet: Launch WPS Spreadsheet and open the document containing your data.
- 2. Select the data range: Highlight the cells you wish to format with your mouse.
- 3. Add a new formatting rule: Navigate to Home > Conditional Formatting > New Rule.
- 4. Apply your custom formula: Select 'Use a formula to determine which cells to format', input your formula, choose your formatting style, and click OK.

Frequently Asked Questions
Why is my conditional formatting formula applying to the wrong cells?
This usually happens due to the incorrect use of absolute ($A$1) versus relative (A1) cell references. Ensure your formula is written relative to the top-left cell of the range you selected before creating the rule.
Can I use XMATCH in conditional formatting formulas?
Yes, modern spreadsheet software supports XMATCH in conditional formatting. If you encounter errors, check if you are using an older version of Excel, in which case you may need to substitute XMATCH with the traditional MATCH function.
How do I manage or edit multiple conditional formatting rules?
You can manage your rules by navigating to Home > Conditional Formatting > Manage Rules. From the Rules Manager window, you can edit formulas, change formatting, delete rules, or adjust their execution priority.




