Identifying duplicate attributes in field using QGIS?

Another graphical, dynamic and most importantly simple way to detect duplicate attributes: use QGIS's expression builder.

Highlight duplicates in attribute table:

Suppose FieldWithDuplicates is the attribute containing duplicates ( TreeID in the screenshot below). Enable Conditional Formatting (see red arrow below) with the following condition:

count("FieldWithDuplicates","FieldWithDuplicates") > 1

To group all duplicates at the top, right click the column, select Sort
Enter the above expression without the >1, and deselect Sort ascending.

duplicate attributes highlighted in QGIS attribute table

Highlight features with duplicate attributes on canvas:

You could add a new symbol or label with the filter set to the above condition.

And of course you can enable a data derived override based on the the same.

For example, if you want to highlight labels for features with a duplicate attribute, you can set it to draw a label background (=1) with the following override:

CASE WHEN
count("FieldWithDuplicates","FieldWithDuplicates") > 1
THEN 1
ELSE 0
END

to achieve something like the following

duplicate attribute labels highlighted in QGIS canvas

In both situations, of course, once you either delete or change the duplicate attributes, the formatting/styling updates instantly.


Use Group Stats plugin and set the ID as a field classification. You can see how many times each value has been entered in 'count' column.


A quick (although inelegant) way to do this is to go into Layer properties, select Style - Categorized using the column that you're interested in. Apply this, then right click on the layer in the layers window and check the Show Feature Count checkbox. Then expand the layer in the layers window and you can immediately see how many times each value has been entered.