Formatting Issues

Excel Conditional Formatting: Compare Values in Each Row

Anum MushtaqAnum Mushtaq Nov 20, 2026 871 views

Question details

Compare values in multiple columns with a reference value in the same row and display colors or icons for higher, equal, or lower values.

Compare Values in Each Row With Excel Conditional Formatting
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants columns N, O, and other columns to be compared with column M on each corresponding row.
Observed behavior
The comparison should follow the row, such as comparing N3 with M3 and N4 with M4, rather than comparing every row with M3.
Before you start

Identify the reference column, the columns to compare, and the first data row. The examples below use column M as the reference and rows 3 through 100; adjust the ranges to match your sheet.

Solution 1Recommended

Color Each Cell Using Row-by-Row Comparison Rules

Use formula-based rules to color the original cells in columns N and O according to their values relative to column M.

1
Select the comparison range

Select N3:O100, starting with N3 as the active cell.

2
Create the higher-value rule

Go to Home > Conditional Formatting > New Rule, choose Use a formula to determine which cells to format, and enter =N3>$M3. Select Format, choose a fill color, and click OK.

3
Create the equal-value rule

With N3:O100 selected, add another formula-based rule using =N3=$M3. Choose a different fill color and click OK.

4
Create the lower-value rule

Add a third formula-based rule using =N3<$M3. Choose a third fill color and click OK.

5
Check the rule ranges

Open Home > Conditional Formatting > Manage Rules and confirm that each rule applies to =$N$3:$O$100. Extend the range if you have more rows or comparison columns.

Color Each Cell Using Row-by-Row Comparison Rules
Why the references change: In each formula, $M3 locks the reference column but allows the row to change. N3 is relative, so the rule compares O3 with M3 and N4 with M4.
Compare rows in WPS Spreadsheets

Color Row-by-Row Comparisons in WPS Spreadsheets

Use formula-based conditional formatting in WPS Spreadsheets to compare each value with the reference in the same row and color the original cells.

  1. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and select the comparison range, such as N3:O100.
  2. 2. Add a higher-value rule: Choose Home > Conditional Formatting > New Rule, select the formula-based rule option, and enter =N3>$M3. Choose a fill color.
  3. 3. Add equal and lower rules: Add rules using =N3=$M3 and =N3<$M3, assigning a different fill color to each.
  4. 4. Check and save: Use Conditional Formatting > Manage Rules to check the applied range, then save the workbook.
Color higher, equal, and lower values with separate rulesUse mixed references to keep comparisons on the correct rowOpen and save Microsoft Excel XLSX filesWork with a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

How do I stop Excel from comparing every row with M3?

Use $M3 rather than $M$3 in the conditional formatting formula. The dollar sign locks column M while allowing the row number to change.

Can one rule compare both columns N and O with column M?

Yes. Select N3:O100 and create a formula-based rule such as =N3>$M3. Excel adjusts the relative N3 reference across columns and rows.

Can an icon set compare two columns directly in each row?

A helper formula is a practical way to make a row-by-row comparison available to an icon set. Return numeric codes in a helper column, then apply the icon rule to those cells.

How can I show icons without the helper numbers?

Select the helper cells, open Home > Conditional Formatting > Manage Rules, edit the icon-set rule, and select Show Icon Only.