Author: Oscar Cronquist Article last updated on January 10, 2019

The image above demonstrates a Conditional Formatting formula that highlights unique distinct records. This means that the first instance of each record is highlighted, however, every duplicateÂ is not highlighted.

Example, Row 13 shown in the image above has a duplicate in row 5. Row 5 is the first instance of that particular record and is highlighted but row 13 is a duplicate and is not highlighted.

I have also written an article about how to extract unique distinct records and counting unique distinct records.

Conditional formatting formula:

=COUNTIFS(\$B\$3:\$B3, \$B3, \$C\$3:\$C3, \$C3, \$D\$3:\$D3, \$D3, \$E\$3:\$E3, \$E3)=1

### Explaining condtional formatting formula in cell B3

The COUNTIFS function calculates the number of cells across multiple ranges that equals all given conditions, it has at least one pair of a criteria1 argument and criteria_range1 argument.

COUNTIFS(criteria_range1,Â criteria1, [criteria_range2,Â criteria2]â€¦)

In this example we have four columns so 4 pairs are needed to calculate if a record is unique distinct or not.

#### Step 1 - Absolute and relative cell references

The first argument in the COUNTIFS function is theÂ criteria_range1 and I am using this cell reference:Â \$B\$3:\$B3

The first part is locked to column B and row 3. \$B\$3 The second part is only locked to column B, the row number changes as the conditional formatting moves on to the next cell below.

This makes the cell reference grow as the conditional formatting moves to cells below.

The same basic technique is used with the other cell references in the COUNTIFS function.

#### Step 2 - Count records

COUNTIFS(\$B\$3:\$B3, \$B3, \$C\$3:\$C3, \$C3, \$D\$3:\$D3, \$D3, \$E\$3:\$E3, \$E3)

becomes

COUNTIFS("Sample0", "Sample0", "B", "B", 11, 11, "AA111", "AA111")

and returns 1.

#### Step 3 - Check if count is equal to 1

COUNTIFS(\$B\$3:\$B3, \$B3, \$C\$3:\$C3, \$C3, \$D\$3:\$D3, \$D3, \$E\$3:\$E3, \$E3)=1

becomes

1=1

and returns TRUE. Cell B3 is highlighted.

Note: Conditional formatting is volatile meaning when the worksheet is recalculated all conditionally formatted cells are recalculated, this may slow down your worksheet considerably.

### Get the Excel file

Highlight-unique-distinct-records.xlsx