Sometimes you may want that you will observe which rows are duplicate in the spreadsheet. Then you can manually delete those rows. It is easy to mark the duplicate rows in a column. For a long list it will take time to delete the duplicate ones manually. But for a small list it works nice. Whatever, the technique is here.
Table of Contents
Highlighting Duplicate Rows: Using Conditional Formatting
At first, you will see how to use conditional formatting feature of Excel to highlight duplicates.
Here’s how to do:
- Select the table column or range of cells where you want to check duplicate values. In our example we have used a table and clicked the column letter A to select the table.
- Choose Home ⇒ Conditional Formatting⇒Highlight Cells Rules⇒ Duplicate Values. The “Duplicate Values” dialog box will appear in the screen. Choose whether you want to highlight the duplicate ones or unique ones from the options. You can also select colors to highlight duplicate ones. We have selected ‘Duplicate’ and “Green Fill with Dark Green Text”.
- Click OK. Excel highlight the duplicate rows with different background and text color, as shown in the image below. If you add a new row in the table and it is duplicate of one of previous rows, Excel automatically will highlight it.
Note: You can select more than one column to highlight the duplicate rows. But there is a little technical problem with this selection. You should be aware of this problem. For example, if a text appears under one column and in another column, Excel will highlight this text as a duplicate though this text is not actually a duplicate text.
This method looks at actual values, not formatted values. For example, 05/12/2013 and 05 Dec 2013 – these two have the same/actual value 05/12/2013, but they are displayed differently when the second one is applied “Long Date” format. In same way $500.50 is different from 500.50 when considered display values, though the first one is just the formatted product of 500.50 value. Observe the following two images. You will get ideas about actual values and formatted values.
Identifying duplicate rows using COUNTIF function
Say you have a column with duplicate rows. You just want to find out which rows are duplicate and how many times they are duplicated. You can find out the duplicate ones with COUNTIF formula. We are going to show how to use COUNTIF formula and how to find out the duplicate ones using this formula. Now this system, I mean using COUNTIF formula works with the values cells contain, not the formatted values.
COUNTIF Function Syntax: COUNTIF (range, criteria)
The range is the range of cells from where you want to find your values.
Read More: How to Remove Duplicate Rows in Excel Table
The criteria can be expressed in many ways. It can be number, expression, cell reference, or text to be fulfilled.
An Example of COUNTIF formula:
COUNTIF(A1:D5, ">250"): how you will read this? Simple: Count in the value if it is greater than 250 in the cell range A1 to D5.
Observe the following image. We have applied this formula
(COUNTIF(A1:D5, ">250") ) in cell E7 and E7 displays the total numbers that are greater than 250 in the cell range A1 to D5.
We shall apply COUNTIF formula to find out the duplicate rows in a column or table. In our example, we have used a column.
First of all, let’s see the inside view of our example file. See the image below.
- Click B1 cell to select it. Write this formula in this cell:
"=COUNTIF (A:A, A1)". A:A means the column A and criteria A1 means: the value of cell A1. In one sentence the whole command is: Count in the value if the value is equal to A1 in column A.
- We shall now copy this formula, =COUNTIF (A:A, A1), into cell B2 to B23 using relative cell references. To do this, select cell B1. A square box will be shown in the bottom-right corner of cell B1, it is called Fill Handle. Click Fill Handle, hold it and grab until you reach cell B23.
- Release the mouse button and you will get the following image.
Download Working File
Download the working file from the link below: