# How to Remove Both Duplicate Rows by Formula in Excel

If you want to remove duplicate data from a list you can use Remove Duplicates function in excel directly, then the unique data will be saved in the list, the duplicate one will be removed. But if you want to remove both duplicates from your list, this function cannot help you. In this article, I will introduce you a simple way to solve this problem.

See the example below. A name list with some duplicate names.

Original List:                                         Updated List after Remove Duplicates:  If you want to remove both duplicate values like ‘Amy’ ‘Cathy’, you can follow below steps.

## Remove Both Duplicate Rows by Formula

Step 1: In cell B2 enter the formula =IF(COUNTIF(\$A\$2:\$A\$9,A2)=1,0,1). In this formula we use IF and COUNTIF functions together. COUNTIF function is used for counting the number of A2 from range \$A\$2:\$A\$9, and IF function is used for returning True of False value. For example, A2 value Ada only appears once in the list, so COUNTIF(\$A\$2:\$A\$9,A2) will return 1 (so COUNTIF(\$A\$2:\$A\$9,A2)=1 is true), so IF function will return 0 in B2. Step 2: Drag the fill handle down to fill the other cells. So B2 to B9 will be filled by this formula. Due to some values are duplicate in the list, you can see for some values IF function returns 0, and for the others returns 1. Step 3: We can see that for the duplicate values, they are marked with 1 in B column. So we can use filter function in B column to filter them out. Select on B1, click Data->Filter. Step 4: Click dropdown list arrow button, only check on value 1 in the list. Then click OK button. x
How to Limit Data Entry in a Cell in Excel

Step 5: Verify that all duplicate values are listed. Step 6: Then you can remove row 3,4,5,8 now. Press Ctrl and select on row 3,4,5,8. Step 7: Right click and select ‘Delete Row’. Verify that these duplicate rows are removed.  Step 8: Remove filter, delete value in column B. Then we get the updated list without duplicate values. Related Posts

If Cell is This Value or That Value

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of logical test. If you want to see if a cell is A or B, and if one of ...

If Value is Greater Than A Certain Value

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the logical test result. If you want to see if a value in one cell is greater than a specific value, ...

If Cell is Not Blank

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if a cell is blank or not, and leave some ...

VBA Macro For VLOOKUP From Another Sheet

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you how to use VBA code to vlookup data ...

If Cell is Blank

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if a cell is blank or not, and leave some ...

If Cell Equals Certain Text String

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if cell equals a certain text string like “Win”, you ...

If Cell Contains Either Text1 or Text2

IF function is frequently used in Excel worksheet to return “true value” or “false value” based on the logical test result. If you want to see if cell contains certain substring1 like “abc” or substring2 like “def”, and returns true ...

If Cell Contains Certain Text OR Equals Certain Text

IF cell equals certain text IF function is frequently used in Excel worksheet to return “true value” or “false value” based on the logical test result. If you want to test values to see if they equal certain text like ...

VLOOKUP From Another Sheet Not Working

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you reasons why your VLOOKUP formula is not working ...

If Cell Begins with One of Three Supplied Characters

If you want to test values to see if they begin with some given specific characters like “x”, ”y”, or “z”, you can create a formula with COUNTIF and SUM functions to return results. EXAMPLE You can see “TRUE” or ...

Sidebar