Working with big amount of data often requires us to identify duplicate values.Microsoft Excel has made finding duplicates very easy. We can combine the COUNTIF and AND functions to find duplicates between columns. In this tutorial, we will learn how to find duplicate values in two columns in Excel.
Figure 1. Example of How to Find Duplicate Values in Two Columns
Generic Formula
=AND(COUNTIF(range1, value1),COUNTIF(range2, value1))
How this formula works
This formula is based on the COUNTIF function. It returns a count of all the values in both range1 and range2. The values returned by COUNTIF will either be zero (0) or a positive number in both ranges. Excel will represent the zeros as FALSE and the positive numbers as TRUE.
The two COUNTIF functions are nested inside an AND function. This will return TRUE if both counts are positive. Otherwise, it will return FALSE. The TRUE instances will represent the duplicate values in the two columns.
Setting Up Data
The following example contains some sample fruit names. Column A and B has these names.
Figure 2. The Example Data Set
To find out whether the names in column B are duplicates, we need to:
- Go to cell C2.
- Assign the formula
=AND(COUNTIF($A$2:$A$6, A2),COUNTIF($B$2:$B$6, A2))
in C2. - Press Enter.
Figure 3. Applying the Formula
- Drag the formula from cells C2 to C6 using the fill handle on the bottom right.
Column C will now show TRUE for the values pineapples and mangoes which are duplicates.
Excel has made working with duplicates very simple. As we saw, combining COUNTIF and AND functions can quickly find out duplicates in two columns. However, we can use conditional formatting to display a more visual result.
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.
Leave a Comment