Formula Errors

How to Fix Excel Conditional Formatting Highlighting the Wrong Rows

Adam DavisAdam Davis Nov 10, 2026 870 views

Question details

The user needs to resolve an issue where Excel conditional formatting rules highlight the wrong rows when using an approximate-match VLOOKUP formula.

How to Fix Conditional Formatting Highlighting the Wrong Rows in Excel
Product
Excel
Device & OS
not provided
Scenario
Applying conditional formatting with a VLOOKUP formula to dynamically highlight rows based on numerical thresholds.
Observed behavior
Conditional formatting highlights incorrect rows because the approximate-match VLOOKUP formula fetches inaccurate results from an unsorted lookup range.
Before you start

Before editing your conditional formatting rules, verify whether your VLOOKUP formula requires an exact match or an approximate threshold match, as this determines how your lookup data must be organized.

Solution 1Recommended

Sort the Lookup Range in Ascending Order

Approximate-match VLOOKUP relies on a binary search algorithm, which requires the first column of the lookup range to be sorted in ascending order to function correctly.

When the fourth argument of VLOOKUP is set to TRUE (or omitted), it performs an approximate match. If the lookup array is unsorted, the binary search gets confused and returns incorrect values, causing your conditional formatting to highlight the wrong rows.

1
Select the Lookup Table

Navigate to the sheet containing your lookup table and select the entire data range.

2
Open the Sort Tool

Go to the 'Data' tab on the ribbon and click on 'Sort'.

3
Sort by the First Column

Choose the first column of your lookup table in the 'Sort by' dropdown, and set the order to 'Smallest to Largest' (A to Z).

4
Verify Formatting

Click 'OK' to apply the sort. Return to your main dataset and verify that the conditional formatting now highlights the correct rows.

Sort the Lookup Range in Ascending Order
Proper Threshold Matching: Sorting ensures that VLOOKUP accurately identifies the next-lowest threshold value when an exact match isn't found.
Advanced Data Formatting

Effortlessly Manage Conditional Formatting with WPS Spreadsheet

WPS Spreadsheet offers full compatibility with Microsoft Excel formulas, including VLOOKUP, XLOOKUP, and complex conditional formatting rules, all within a free and highly intuitive interface.

  1. 1. Open your data: Launch WPS Spreadsheet and open your workbook.
  2. 2. Select the target rows: Highlight the range of cells or entire rows where you want the conditional formatting applied.
  3. 3. Create a new rule: Go to the Home tab, click 'Conditional Formatting', choose 'New Rule', and select 'Use a formula to determine which cells to format'.
  4. 4. Apply the lookup formula: Enter your VLOOKUP formula accurately, set your preferred highlight style, and click OK to effortlessly format your data.
100% compatible with Microsoft Excel (.xlsx) formatsSupports advanced conditional formatting and complex array formulasFree, lightweight, and fast data processingBuilt-in diagnostic tools to easily spot formula errors
microsoft office alternative - wps office

Frequently Asked Questions

Why does approximate-match VLOOKUP return the wrong value?

Approximate-match VLOOKUP uses a binary search algorithm. If the first column of the lookup range is not sorted in ascending order, the binary search evaluates the data incorrectly and returns an unexpected value.

Can I use XLOOKUP instead to fix the conditional formatting?

Yes. XLOOKUP does not require the data to be sorted for exact matches, and it gives you explicit control over finding the next-smaller or next-larger item if an exact match is missing. Replacing VLOOKUP with XLOOKUP is often a more robust solution.

How do I apply a conditional formatting formula to an entire row?

To highlight an entire row based on a single cell's value, you must use an absolute column reference in your formula. For example, use =$A2>50 instead of =A2>50 when setting up the rule, and apply it to the entire dataset range.