In this article, we will learn How to Identify Duplicate Rows within a Range in Excel.
Scenario:
In Excel, When you want to know what values are common in 2 or more columns. We have a couple of options to solve this problem. First is highlighting the duplicate values using conditional formatting is the best way to see them visually. Second by using Excel formulas which is preferable to users who are efficient in excel. No problem, choose whichever method you like, it works. First Learn how to identify duplicate values in excel.
Duplicate using conditional formatting
Just go to the home tab and find the conditional formatting option. Now click on highlight duplicates.
Note : This formula color all the occurrences of the duplicate values including first.
Example :
All of these might be confusing to understand. Let's understand how to use the function using an example.
Here, I want you to highlight duplicates in ranges A1:A10, C2:C5 and D1:D6. Follow these steps:
To highlight duplicates, select all ranges. To select non adjacent ranges, hold the CTRL key and use the mouse to select ranges.
Now go to Home->Conditional Formatting->Highlight Cells Rules->Duplicate Values.
(Or you can use ALT>H>L>H>D>ENTER sequential shortcut to highlight duplicates)
Hit Enter or Click OK. (before you hit enter, you can see in a small drop down, option is available to highlight duplicates or unique values. And the default formatting option. You may select whatever you like.
You can see each duplicate value highlighted by a color.
It is damn easy to highlight duplicate values in excel. Now first, second, third,.. All occurrences get highlights but what if we want the second, third, fourth occurrences as these are the duplicate. Learn how to do it using the Excel formula explained below.
Earlier we learned how to highlight the entire if any cell in row contains specific text. Now we will learn how to separate duplicate values where the first occurrence is considered as a unique value. For example: In an array of 1 , 2 , 3 , 1 , 4 & 5 , Only the 1 at 4th number will be coloured differently. Separation is done on the basis of cell format. So we know conditional formatting is our tool.
we will highlight the row using conditional formatting.
Generic Formula in Conditional Formatting
= COUNTIF ( $R$1:R1 , >1) |
Cell with relative row: this is a cell reference where the column is absolute and row is relative. For example $A$1 (fixed row and column) and $A1 (fixed row) and A$1 (fixed column) . Learn in detail about referencing in excel here.
> 1 : It is the criteria that you want to match and highlight.
Example :
All of these might be confusing to understand. Let's understand how to use the function using an example. Here I have some data on fruits. I just want to highlight the entire row if the fruit rate is greater than 100.
Select the row of table (A2:C2).
Go to conditional formatting and click on the new rule. You can use a sequential shortcut ALT>H>L>N.
Select “use a formula to determine which cell to format”.
Write this formula.
=COUNTIF($D$2:D2,D2)>1 |
It is necessary to select the entire row before doing conditional formatting.
Click on format and choose any color in fill. Hit ok.
Copy this range and paste the special format to the entire table.
Now each cell will be highlighted whose frequency or occurrence is greater than 1. Here I have hardcoded the criteria, but you can give cell reference too.
How does it work?
Well, it is quite simple. Here the formula just colours the cell where count of value comes greater than 1. In the first occurrence of the value, the count remains 1.
Note that only the cell $D$2 is frozen using $ and row are left relative. It is because we want to change the lookup row when we copy the conditional formatting and the column stands absolute. In the end we get highlighted cells that contain values greater than 1. Learn about referencing in detail here.
So yeah guys, this is how you can highlight the entire row based on cell value or criteria. This is quite easy if you understand absolute and relative referencing in excel.
Here are all the observational notes regarding using the formula.
Notes:
Hope this article about How to Identify Duplicate Rows within a Range in Excel is explanatory. Find more articles on calculating values and related Excel formulas here. If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write to us at info@exceltip.com.
Related Articles :
How to use the SUMPRODUCT function in Excel: Returns the SUM after multiplication of values in multiple arrays in excel. This function can be used to do multiple tasks. This is one of the most versatile functions.
COUNTIFS with Dynamic Criteria Range : To count with dynamic criteria range we simply use the INDIRECT function. This function can
COUNTIFS With OR For Multiple Criteria : Count cells having multiple criteria match using the OR function. To put an OR logic in COUNTIFS function you will not need to use the OR function.
Using the IF with AND / OR Functions in Microsoft Excel : These logical functions are used to carry out multiple criteria calculations. With IF the OR and AND functions are used to include or exclude matches.
How to use OR function in Microsoft Excel : The function is used to include all the TRUE values in multiple criterias.
How to Count Cells That Contain This Or That in Excel in Excel :To cells that contain this or that, we can use the SUMPRODUCT function. Here's how you do those calculations.
Popular Articles :
50 Excel Shortcuts to Increase Your Productivity : Get faster at your tasks in Excel. These shortcuts will help you increase your work efficiency in Excel.
How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.
How to use the IF Function in Excel : The IF statement in Excel checks the condition and returns a specific value if the condition is TRUE or returns another specific value if FALSE.
How to use the SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.
How to use the COUNTIF Function in Excel : Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.