Formatting Issues

Use Excel Conditional Formatting to Color Adjacent Cells

Elise WilliamsElise Williams Dec 2, 2026 869 views

Question details

Automatically color a cell based on the condition in the cell to its left.

Use Excel Conditional Formatting to Color Adjacent Cells
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.
Before you start

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".

Solution 1Recommended

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.

1
Select the target range

In Excel, select cells C2:D100, or select your own two-column range starting at the row used in the formula.

2
Create a formula rule

Go to Home > Conditional Formatting > New Rule and choose Use a formula to determine which cells to format.

3
Enter the condition

Enter =$C2="Moon". The dollar sign fixes the reference to column C, while the row number adjusts for each row.

4
Choose the color

Select Format, choose a fill color on the Fill tab, and click OK to save the rule.

5
Check the applied range

Go to Home > Conditional Formatting > Manage Rules and confirm that Applies to includes both columns, such as =$C$2:$D$100.

Apply one conditional formatting rule to both columns
Matching an existing fill color: This formula checks the cell's value, not its displayed fill color. To match a color produced by another conditional formatting rule, use the same condition and color for both columns.
WPS Spreadsheets

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. 1. Open your spreadsheet: Open the workbook in WPS Spreadsheets and select the target range, such as C2:D100.
  2. 2. Create a rule: On the Home tab, choose Conditional Formatting > New Rule, then select the formula-based rule option.
  3. 3. Set the condition and color: Enter =$C2="Moon" in the formula field, select Format, and choose a fill color.
  4. 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.
Apply one text-based color rule across adjacent cells.Open and edit Microsoft Excel XLSX files.Use a familiar spreadsheet interface to manage formatting rules.
microsoft office alternative - wps office

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".