To compare two columns and remove the duplicate values, we have already posted a tutorial about how to solve this problem by ‘Conditional Formatting’ feature ‘Remove Duplicate’ rule. Actually, there are some other ways to solve it as well. If you are not familiar with ‘Conditional Formatting’ feature, you can also use a formula to compare columns and remove the duplicate values. In this article, we will introduce you how to apply **IF**, **ISERROR **and **MATCH** functions in a formula to compare data, I hope after reading this article, you will find the way to resolve your problem.

**Precondition:**

See screenshot below. We prepare two lists with fruits. As the two lists are simple, so we can see ‘Apple’ exists in both two columns obviously. But if the list is very long, we cannot compare them easily, we need to use formula to compare them.

**Method: Compare Two Columns and Remove Duplicates by Formula**

**Step 1:** In B2 which is just between two columns, enter the formula **=IF(ISERROR(MATCH(A2,$C$2:$C$7,0)),”Not Duplicate”,”Duplicate”)**.

**Step 2:** Press **Enter** to get value. Verify that we get ‘Duplicate’ in B2. That means ‘Apple’ in list1 also exists in list2.

**Step 3:** Drag the fill handle down till the end of the list.

**Step 4:** Now we already find out duplicate values, if you want to remove the duplicate value from list1, you can click B1, then click **Data->Filter** under **Sort & Filter** group.

The filter dropdown list is created.

**Step 5:** Click the small arrow button to load criteria, check on ‘Duplicate’, then click **OK**.

Duplicate value in list1 is displayed.

**Step 6:** Just remove duplicate value from filtered list1. Now there is no duplicate value now.

### Related Functions

- Excel IF function

The Excel IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])…. - Excel ISERROR function

The Excel ISERROR function used to check for any error type that excel generates and it returns TRUE for any error type, and the ISERR function also can be checked for error values except #N/A error, it returns TRUE while the error is #N/A. The syntax of the ISERROR function is as below:= ISERROR (value)…. - Excel MATCH function

The Excel MATCH function search a value in an array and returns the position of that item.The syntax of the MATCH function is as below:= MATCH (lookup_value, lookup_array, [match_type])….