Excel is a powerful tool for organizing and analyzing data. One common task when working with Excel is to identify and highlight duplicate values. In this article, we will show you how to highlight cells with duplicate test results in Excel.
Finding Duplicates in Excel
Excel has a built-in feature for finding duplicates in a range of cells. Here's how to use it:
- Select the range of cells that you want to check for duplicates.
- Go to the Home tab and click on the Conditional Formatting button in the Styles group.
- Select Highlight Cell Rules and then Duplicate Values.
- In the Duplicate Values dialog box, select the formatting option that you want to use to highlight the duplicate cells. You can choose from several predefined options or create a custom format.
- Click OK to apply the formatting to the selected cells.
Excel will now highlight all the cells in the selected range that contain duplicate values. Note that if a cell has the same value as another cell in the range, it will be highlighted even if the other cell is not in the selected range. If you only want to highlight cells that are exact duplicates of other cells in the selected range, you can use a different method.
Highlighting Exact Duplicates
To highlight only the cells that are exact duplicates of other cells in the selected range, you can use a formula-based approach. Here's how:
- Select the range of cells that you want to check for duplicates.
- Go to the Home tab and click on the Conditional Formatting button in the Styles group.
- Select New Rule.
- In the New Formatting Rule dialog box, select Use a formula to determine which cells to format.
- In the Format values where this formula is true box, enter the following formula:
=COUNTIF($A$1:$A$10, A1)>1Replace
A1with the top-left cell of your selected range, andA$1:A$10with the range that you want to check for duplicates. For example, if your selected range isB2:B11, the formula would be:=COUNTIF($B$2:$B$11, B2)>1This formula uses the
COUNTIFfunction to count the number of times that the value in the current cell appears in the range. If the count is greater than 1, the formula returnsTRUE, which triggers the conditional formatting. If the count is 1, the formula returnsFALSE, and the formatting is not applied. - Click Format to specify the formatting that you want to use for the duplicate cells. You can choose the fill color, font color, and other options.
- Click OK to apply the formatting to the selected cells.
Excel will now highlight only the cells that are exact duplicates of other cells in the selected range. If you want to highlight only the first occurrence of each duplicate, you can modify the formula slightly. Instead of using COUNTIF, use the COUNTIFS function, which allows you to specify multiple criteria. Here's how:
- Modify the formula to use
COUNTIFSinstead ofCOUNTIF:=COUNTIFS($B$2:$B$11, B2, $B$2:$B$11, <>"""")>1This formula counts the number of times that the value in the current cell appears in the range, excluding blank cells. If the count is greater than 1, the formula returns
TRUE, which triggers the conditional formatting. If the count is 1, the formula returnsFALSE, and the formatting is not applied. - Click Format to specify the formatting that you want to use for the first occurrence of each duplicate. You can choose a different fill color, font color, or other options.
- Click OK to apply the formatting to the selected cells.
Excel will now highlight only the first occurrence of each duplicate. If you want to highlight both the first and the second occurrence, you can use the same formula as before. If you want to highlight all the occurrences except the first one, you can use a slightly different formula:
=COUNTIF($B$2:$B$11, B2)>1
This formula counts the number of times that the value in the current cell appears in the range, including the current cell. If the count is greater than 1, the formula returns TRUE, which triggers the conditional formatting. If the count is 1, the formula returns FALSE, and the formatting is not applied. Note that this formula will also highlight the second occurrence of each duplicate, so you may want to use a different fill color or font color to distinguish it from the first occurrence.
In this article, we have shown you how to highlight cells with duplicate test results in Excel. You can use the built-in feature to find duplicates in a range of cells, or you can use a formula-based approach to highlight only the exact duplicates. You can also use different formatting options to distinguish the duplicates from the original values. With these techniques, you can easily identify and manage duplicate data in Excel.
References
| Title | Author | Date | URL |
|---|---|---|---|
| Highlight Duplicate Values in Excel | Microsoft Support | November 2021 | https://support.microsoft.com/en-us/office/highlight-duplicate-values-in-excel-87de2a26-0e34-4903-9988-bc855b958c78 |
| Highlight Duplicates in Excel | Chip Pearson | November 2021 | https://www.excelfunctions.net/highlight-duplicates-in-excel.html |
| Highlight Duplicate Rows in Excel | Excel Easy | November 2021 | https://www.excel-easy.com/data-analysis/highlight-duplicates.html |