![excel find duplicate rows and blank them out excel find duplicate rows and blank them out](https://exceloffthegrid.com/wp-content/uploads/2018/02/Unique-Duplicate-values-with-formulas.png)
If both the columns contain duplicate information, the row of data will be deleted from the range. In this example, I check the third and fifth columns. RemoveDuplicates Columns : = Array ( 3, 5 ), Header : = xlYes
![excel find duplicate rows and blank them out excel find duplicate rows and blank them out](https://www.alphr.com/wp-content/uploads/2018/08/120.3A-1024x414-1.png)
The following example would have worked just as well: Your range doesn’t have to be defined as its own variable. In my example macro, I defined a variable MyRange and set it equal to the data in columns A:D. The RemoveDuplicates function must be applied to a particular range. More about RemoveDuplicates VBA Applying RemoveDuplicates Yes, some of the cities cross multiple counties so the example isn’t the best, but you get the idea. Here’s the list of Irish cities with the duplicates removed using the RemoveDuplicates method: This works because the data was already sorted by population. What you’re left with is a shorter list that contains the largest city in each county - all the less populated cities were deleted since the county names in the less populated cities were duplicates. It starts at the top of the 3rd column, the County Column, and removes all subsequent duplicates in that column. This is exactly what the RemoveDuplicates example macro above does.
![excel find duplicate rows and blank them out excel find duplicate rows and blank them out](https://www.excelatwork.co.nz/wp-content/uploads/2015/04/CheckForDuplicates3.png)
Likewise, you’d want to delete row 19 (rank 18) since County Kildare already appears in row 16 (rank 15). For example, you would want to delete rows 8 and 18 (rank 7 and 17) since County Dublin already appears in row 2 (rank 1). Normally, you would go through all the data in the 3rd column and delete all the rows with a duplicate county after the first instance appears. Instead of listing the most populated cities in the entire country of Ireland, you want to find the most populated cities in each county. The list looks something like this, with the city name, county and population: Let’s say you have a list of the most populated cities in Ireland.