Formatting Issues

Highlight Duplicate Rows in Excel When a Specific Number Exists

John WilsonJohn Wilson Dec 2, 2026 869 views

Question details

Highlight all rows with a duplicated value in column B when at least one row in that duplicate group has 1154798451 in column F.

Highlight Duplicate Rows in Excel When a Specific Number Exists
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet has repeated values in column B, and the user wants to identify duplicate groups associated with a specific number in column F.
Observed behavior
Every row in a qualifying duplicate group should be highlighted, including rows where column F does not contain the specified number.
Before you start

Identify the first and last data rows and confirm that column F stores 1154798451 as a number. The example uses rows 1–100; adjust the ranges and starting row to match your worksheet.

Solution 1Recommended

Use a Formula-Based Conditional Formatting Rule in Excel

Highlight every row in a duplicate group when at least one matching row contains the specified number.

1
Select the rows

Select A1:F100, with A1 as the active cell. Adjust the selection to cover the rows and columns you want to highlight.

2
Create a rule

On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.

3
Enter the formula

Enter =AND(COUNTIF($B$1:$B$100,$B1)>1,COUNTIFS($B$1:$B$100,$B1,$F$1:$F$100,1154798451)>0). Keep the B and F ranges the same size and match the row in $B1 to the first row of your selection.

4
Choose a highlight

Select Format, open the Fill tab, choose a color, and select OK. Select OK again to apply the rule.

Use a Formula-Based Conditional Formatting Rule in Excel
Exclude blank values if needed: Blank cells in column B can also be counted as duplicates. To ignore them, add $B1<>"" as another condition inside AND.
Highlight duplicates in WPS Spreadsheets

Highlight Matching Duplicate Rows in WPS Spreadsheets

Use a formula-based conditional formatting rule in WPS Spreadsheets to highlight duplicate groups associated with the number in column F.

  1. 1. Open the worksheet: Open your workbook in WPS Spreadsheets and select A1:F100, or the range you want to highlight.
  2. 2. Create a formatting rule: On the Home tab, open Conditional Formatting and select New Rule. Choose the option to use a formula to determine which cells to format.
  3. 3. Enter the formula: Enter =AND(COUNTIF($B$1:$B$100,$B1)>1,COUNTIFS($B$1:$B$100,$B1,$F$1:$F$100,1154798451)>0), adjusting the ranges and first-row reference to match your selection.
  4. 4. Apply a fill color: Select Format, choose a fill color, and confirm the formatting rule.
Highlight all rows in a qualifying duplicate groupOpen and edit Microsoft Excel XLSX and XLS filesChoose a fill color that makes matching rows easy to spot
microsoft office alternative - wps office

Frequently Asked Questions

Why are rows highlighted even when column F has a different number?

The rule highlights every row with the same duplicated column B value if at least one row in that group has 1154798451 in column F.

How do I apply the rule when my data starts on row 2?

Select a range such as A2:F100 and use =AND(COUNTIF($B$2:$B$100,$B2)>1,COUNTIFS($B$2:$B$100,$B2,$F$2:$F$100,1154798451)>0). The relative reference $B2 must match the first selected row.

What if the number in column F is stored as text?

Convert the values in column F to numbers, or replace 1154798451 in the formula with "1154798451" to match a text value.

Can I highlight only column B instead of the entire row?

Select B1:B100 before creating the rule. Keep the formula's B and F ranges aligned with those rows.