Formatting Issues

How to Apply Conditional Formatting in Excel When Row Value Plus 5 Matches Another Row

Steven ParkerSteven Parker Nov 10, 2026 868 views

Question details

The user needs to apply conditional formatting to a row in Excel based on whether its cell values, when increased by 5, match any values in a specific reference row.

How to Apply Conditional Formatting in Excel When Row Value Plus 5 Matches Another Row
Product
Excel
Device & OS
not provided
Scenario
Highlighting data in a spreadsheet based on a specific mathematical condition between two rows.
Observed behavior
Cells in the target row are highlighted automatically when the value plus 5 exists in the reference row.
Before you start

Ensure you have clearly identified the reference row and the target row you want to format, and note the starting cell references for your formula.

Solution 1Recommended

Use the COUNTIF Formula for Conditional Formatting

The most efficient way to solve this in Excel without scripts is to use a formula-based conditional formatting rule.

1
Select the target row

Highlight the cells in the row you want to apply the formatting to (for example, select cells B3 through Z3).

2
Open Conditional Formatting

Go to the 'Home' tab on the Excel ribbon, click on 'Conditional Formatting', and select 'New Rule' from the dropdown menu.

3
Choose the formula option

In the New Formatting Rule dialog box, select the option 'Use a formula to determine which cells to format'.

4
Enter the COUNTIF formula

In the formula input box, type =COUNTIF($B$2:$Z$2,B3+5)>0. Make sure to adjust the absolute range ($B$2:$Z$2) to match your actual reference row, and change B3 to the first cell of your target row.

5
Set the format and apply

Click the 'Format' button to choose your desired highlight color under the Fill tab. Click 'OK' on the format window, and then click 'OK' again to apply the rule to your selected cells.

Use the COUNTIF Formula for Conditional Formatting
Reference Locking: Using the dollar signs ($) locks the reference row so the formula checks against the exact same range for every cell evaluated in the target row.
Efficient Spreadsheet Management

Easily Apply Conditional Formatting with WPS Spreadsheet

WPS Office provides a highly compatible and user-friendly spreadsheet tool that perfectly supports advanced conditional formatting formulas, including COUNTIF rules, to help you analyze your data quickly.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your .xlsx workbook containing the data you wish to format.
  2. 2. Select your target range: Highlight the row where you want the conditional formatting to appear.
  3. 3. Apply a New Rule: Go to the Home tab, click Conditional Formatting > New Rule, and select the 'Use a formula' option.
  4. 4. Input the formula: Type =COUNTIF($B$2:$Z$2,B3+5)>0, choose your highlight format, and click OK to apply the highlighting automatically.
Fully compatible with Microsoft Excel formulas and .xlsx files.Intuitive interface for applying and managing conditional formatting rules.Lightweight and fast, even with large datasets.Free to use with comprehensive data analysis tools.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my conditional formatting applying to the wrong cells?

This usually happens when absolute and relative references are mixed up. Ensure your reference range uses absolute references (like $B$2:$Z$2) while the target cell uses a relative column reference (like B3) so the formula evaluates each cell individually.

Can I subtract 5 instead of adding 5 in the formula?

Yes, you can simply change the mathematical operator in the formula to =COUNTIF($B$2:$Z$2,B3-5)>0 to check if the row value minus 5 matches any cell in the reference row.

Does the COUNTIF formula work for text values?

The COUNTIF function itself works perfectly for text, but since you are performing a mathematical operation (+5) in this scenario, the formula strictly requires numeric values in the target row to evaluate without errors.