Use Excel Conditional Formatting to Color Adjacent Cells
Question details
Automatically color a cell based on the condition in the cell to its left.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Apply the same conditional formatting to cells in columns C and D when the cell in column C contains a specified value.
- Observed behavior
- Both cells in a row should receive the chosen color when the value in column C meets the condition.
Identify the column containing the text condition and the range you want to format. The example below checks column C and formats C2:D100 when a cell in column C equals "Moon".
Apply one conditional formatting rule to both columns
Use a formula with a fixed column reference to format adjacent cells based on the value in column C.
In Excel, select cells C2:D100, or select your own two-column range starting at the row used in the formula.
Go to Home > Conditional Formatting > New Rule and choose Use a formula to determine which cells to format.
Enter =$C2="Moon". The dollar sign fixes the reference to column C, while the row number adjusts for each row.
Select Format, choose a fill color on the Fill tab, and click OK to save the rule.
Go to Home > Conditional Formatting > Manage Rules and confirm that Applies to includes both columns, such as =$C$2:$D$100.

Color Adjacent Cells in WPS Spreadsheets
Create a formula-based conditional formatting rule in WPS Spreadsheets to color both cells based on the text in the left column.
- 1. Open your spreadsheet: Open the workbook in WPS Spreadsheets and select the target range, such as C2:D100.
- 2. Create a rule: On the Home tab, choose Conditional Formatting > New Rule, then select the formula-based rule option.
- 3. Set the condition and color: Enter =$C2="Moon" in the formula field, select Format, and choose a fill color.
- 4. Apply the rule: Confirm the formatting and save the rule. Use Conditional Formatting > Manage Rules to check that the applied range includes both columns.

Frequently Asked Questions
Why does the formula use $C2 instead of C2?
The dollar sign fixes the reference to column C, so the rule checks column C for both cells. With C2, the column reference shifts to D when the rule evaluates a cell in column D.
How do I apply the rule to more rows?
In Excel, open Home > Conditional Formatting > Manage Rules and expand the Applies to range, for example from =$C$2:$D$100 to =$C$2:$D$500.
Can the rule copy a manually applied fill color?
A standard conditional formatting formula does not read a cell's fill color. Instead, apply a rule based on the underlying value or condition to both cells.
What if my selected range starts on a different row?
Use the first row of the selected range in the formula. For example, for C5:D100, enter =$C5="Moon".




