Excel Conditional Formatting: Compare Values in Each Row
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.

- 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.
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.
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.
Select N3:O100, starting with N3 as the active cell.
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.
With N3:O100 selected, add another formula-based rule using =N3=$M3. Choose a different fill color and click OK.
Add a third formula-based rule using =N3<$M3. Choose a third fill color and click OK.
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.

Display Comparison Icons in a Helper Column
Use a helper formula and an icon set when you want an icon for each row-by-row comparison.
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. Open the workbook: Open your Excel workbook in WPS Spreadsheets and select the comparison range, such as N3:O100.
- 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. Add equal and lower rules: Add rules using =N3=$M3 and =N3<$M3, assigning a different fill color to each.
- 4. Check and save: Use Conditional Formatting > Manage Rules to check the applied range, then save the workbook.

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.




