To mark the first duplicate in a list, you can use a formula based on the COUNTIF function. Optionally, you can flag subsequent duplicates with a different marker. In the example shown the formula in cell C4 is:
This part of the formula uses an expanding reference ($B$4:B4) that expands as the formula is copied down the column. (The first B4 in the range is absolute (locked), the second is relative, so it changes as the formula is copied down the list).
Remember that this part of the formula is only executed if the first COUNTIF returned a number greater than 1. So, at each row, the formula checks the count inside the range up to the current row. If the count is 1, we mark the duplicate with "x", since it's the first one we've seen. If it's not 1, we know it must be a subsequent duplicate, and we mark with "xx"
Of course, you can customize these markers any way you like.
If you don't want to mark subsequent dups at all, just use "" instead of "xx".
Note: Excel contains many built-in "presets" for highlighting values with conditional formatting, including a preset to highlight duplicate values. However, if you want more flexibility, you can highlight duplicates with your own formula, as...
Does a range contain duplicate values? If you want to test a range (or list) for duplicates, you can do so with a formula that uses COUNTIF together with SUMPRODUCT. In the example, there is a list of names in the range B3:B11. If you want to test...
COUNTIF is a function to count cells that meet a single criteria. COUNTIF can be used to count cells with dates, numbers, and text that match specific criteria. The COUNTIF function supports logical operators (>,...
In this video, we look at how to compare two lists using conditional formatting. This is a great way to visually highlight different or missing items in a list.
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.