Formatting Issues

How to Match Positive and Negative Values Using Excel Conditional Formatting

Anum MushtaqAnum Mushtaq Nov 2, 2026 869 views

Question details

The user needs to set up a conditional formatting rule to correctly identify and highlight matching number pairs where one value is positive and the corresponding value is negative.

How to Match Positive and Negative Values Using Excel Conditional Formatting
Product
Excel
Device & OS
not provided
Scenario
Reconciling data where positive and negative amounts need to offset each other, requiring visual confirmation of matched pairs.
Observed behavior
Basic conditional formatting rules only highlighted values based on being greater or less than zero, without actually confirming if the exact opposite matching value existed in the dataset.
Before you start

Ensure that your target data range contains purely numeric values, and remove any hidden spaces or text formats that might prevent the formulas from accurately reading the numbers.

Solution 1Recommended

Use Formula-Based Conditional Formatting (Recommended)

Apply a custom COUNTIF and ABS formula to check if the exact opposite value exists within the same range, highlighting all valid pairs in a shared color.

Standard conditional formatting presets cannot compare matching positive and negative numbers. By using a formula rule, you can command Excel to check the absolute values in the range and verify if an opposing positive or negative number is present.

1
Select your data range

Highlight the cells containing the amounts you want to match, for example, cells B2 through B100.

2
Open Conditional Formatting

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

3
Choose the formula option

Click on 'Use a formula to determine which cells to format' from the list of rule types.

4
Enter the matching formula

In the formula bar, enter: =COUNTIF($B$2:$B$100,-ABS(B2))+COUNTIF($B$2:$B$100,ABS(B2))>0 (adjust the range $B$2:$B$100 to match your actual data layout).

5
Apply a highlight format

Click the 'Format' button, choose a fill color to highlight your matching pairs, and click 'OK' to apply the rule.

Use Formula-Based Conditional Formatting (Recommended)
Check Your Range References: Ensure you use absolute references (with the $ sign) for the search range, and a relative reference (without $) for the individual cell being evaluated.
Advanced Spreadsheet Features

Highlight Matching Values Easily in WPS Spreadsheet

WPS Spreadsheet fully supports advanced conditional formatting formulas, allowing you to seamlessly use COUNTIF and ABS functions to reconcile positive and negative data without requiring complex add-ins.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open your financial or data document containing the values.
  2. 2. Select your data: Highlight the column or range of numbers you want to analyze for matching pairs.
  3. 3. Create a new rule: Navigate to the Home tab, click 'Conditional Formatting', and select 'New Rule'.
  4. 4. Apply the formula: Choose 'Use a formula to determine which cells to format', enter your formula, pick a fill color, and click OK.
100% compatible with Microsoft Excel (.xlsx) conditional formatting and complex formulas.Intuitive and user-friendly interface for creating, managing, and editing rules.Lightweight, fast software that runs efficiently on Windows, Mac, and Linux.
microsoft office alternative - wps office

Frequently Asked Questions

Why did my previous conditional formatting rule highlight numbers without matching them?

Basic predefined rules, such as 'Greater Than' or 'Less Than' zero, simply check each cell individually against zero. They do not cross-reference the rest of your data to ensure an exact offsetting opposite value exists.

Does this formula work if there are multiple duplicate values?

If there are duplicate values (for example, two 50s and one -50), the COUNTIF formula will highlight all three cells. To match them exactly 1-to-1 and leave the extra unpaired value unhighlighted, you would need to set up helper columns or utilize a custom VBA macro.

Can I automatically delete the highlighted matched pairs?

Conditional formatting only changes the visual appearance of cells. To remove the matched pairs, you can filter your data by the conditional formatting color and delete the visible rows, or use a Power Query setup to filter out values that sum to zero.