Highlight unique distinct records
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:
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.
Cf unique distinct category
The image above shows conditional formatting highlighting unique distinct values, duplicates are not highlighted. Conditional Formatting Formula: =COUNTIF($B$3:B3, B3)=1 The […]
The following formula highlights cells that contain unique distinct values, in other words, all duplicate values except the first instance […]
This article demonstrates a conditional formatting formula that allows you to highlight unique values based on a set of filtered […]
Conditional formatting category
This article explains how to count cells highlighted with Conditional Formatting (CF). The image above shows data in cell range […]
The image above demonstrates a conditional formatting formula that colors a record if there is at least one record that […]
adam asks: Hi, I have a situation where I want to count if this value is duplicate and if it […]
Functions in this article
More than 1300 Excel formulas
Conditional Formatting categories
Excel categories
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.