How to remove duplicates and replace with blank cells in Excel?

Normally when you apply Remove Duplicates command in Excel, it removes the entire duplicate rows. But sometimes, you want the blank cells to replace the duplicate values, in this situation, the Remove Duplicate command will not work. This article is going to guide you remove duplicates and replace with blank cells in Excel.

Remove duplicates and replace with blank cells with Excel function

Remove duplicates and replace with blank cells with Kutools for Excel


arrow blue right bubble Remove duplicates and replace with blank cells with Excel function


If there are some duplicate data in a range, the following two formulas will guide you to remove all duplicates and leave blank cells in the range. Please do as follows:

1. In the adjacent blank cell, in the case, in cell D2, enter the formula =IF(A2="","",IF(COUNTIF($A2:A15,A2)=1,A2,"")). See screenshot:

doc-replace-duplicates-with-blank1

2. Press Enter key, and click cell D2, and then drag the fill handle across to the range that you want to contain this formula. And the remaining values will keep the last item of the duplicates, others have been removed and leave blank cells. See screenshots:

doc-replace-duplicates-with-blank2 -2 doc-replace-duplicates-with-blank3

3. As they are formulas, when you want to copy them, please paste as values.

Tip: If you need to replace all the duplicate values with blank cells and only keep the unique values, the following formula can help you: =IF(A2="", "", IF(COUNTIF(A$2:A$15,A2)>1,"",A2)), and then you will get the following results:

doc-replace-duplicates-with-blank2 -2 doc-replace-duplicates-with-blank4

Note: You can replace cell references in above two formulas according to your case.


arrow blue right bubble Remove duplicates and replace with blank cells with Kutools for Excel

The Select Duplicate & Unique Cells utility of Kutools for Excel can help you quickly select the duplicate values in a range. On the other hand, with this utility, you can also compare two ranges, and select all duplicates in one range at once.

Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.

1. Select the range that you want to apply this utility.

2. Click Kutools > Select Tools > Select Duplicate & Unique Cells, see screenshot:

doc-replace-duplicates-with-blank5

3. In the Select Duplicate & Unique Cells dialog box, select Duplicates (Except 1 st one) or All duplicates (Including 1 st one) as you need. See screenshot:

doc-replace-duplicates-with-blank6

4. Then click OK, if you select Duplicates (Except 1 st one) option, the duplicate values have been selected which not contain the values appear for the first time. And then press the Delete key to remove them. See screenshots:

doc-replace-duplicates-with-blank7 -2 doc-replace-duplicates-with-blank8 -2 doc-replace-duplicates-with-blank9

5. If you select All duplicates (Including 1 st one) option, all the duplicate values which contain the values appear for the first time, and only leave the unique values. And then press the Delete key to remove them. See screenshots:

doc-replace-duplicates-with-blank7 -2 doc-replace-duplicates-with-blank10 -2 doc-replace-duplicates-with-blank11

Note: Select entire rows: With this option, the entire rows which contain the same values will be selected.

If you want to know more detail information about this function, please visit Select Duplicate & Unique Cells.


Related articles:


Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more      btn download     btn purchase

Comments  

Permalink +2 GT
how to retain the duplicated value on top? because it always stay at the bottom
2014-10-11 08:32 Reply Reply with quote Quote
Permalink +2 BenL
I was having the same issue and used the following formula to display the first duplicated value but no others:

=IF(A2="","",IF(COUNTIF($A$2:$A$286,A2)=(COUNTIF(A2:A286,A2)),A2,""))

I had 286 rows of data in the sheet I was working with. Hope this helps!
2014-11-03 17:11 Reply Reply with quote Quote
Permalink 0 Jac
Thanks for sharing this! It saved me hours!
2016-06-30 00:14 Reply Reply with quote Quote
Permalink 0 Oliver
Fantastic hint. That was exactly what I was looking for. You made my day!
2016-07-19 15:17 Reply Reply with quote Quote
Permalink 0 Petter
Please note that on office for mac semicolon is used to separate variables in function calls, which gives you
=IF(A2="";"";IF (COUNTIF($A2:A9 99;A2)=1;A2;"") )
2014-11-25 08:57 Reply Reply with quote Quote
Permalink +2 Satyam
Use the following VBA code

Sub RemoveDupes()
Dim X As Long
For X = 1 To Range("A" & Rows.Count).End (xlUp).Row
If Application.Wor ksheetFunction. CountIf(Range(" A1:A" & X), Range("A" & X).Text) > 1 Then Rows(X).ClearContents
Next
End Sub

It works for me.

Thanks to Blade Hunter www.mrexcel.com/forum/excel-questions/768398-how-remove-duplicates-replace-blank-cells-excel.html#post3766476
2014-12-01 05:54 Reply Reply with quote Quote
Permalink 0 Nat
You're a genius!!!! Just saved me half a day :)
2015-01-09 12:36 Reply Reply with quote Quote
Permalink 0 Dib
Hi really need help, i having the same problem however i need the first data and clear out any succeeding duplicates. Like if i have 5 "jane" in a range, i would need 1 "jane"(the very first in line) and delete the rest. I see with the given solution that it actually delete all 5 "jane"s.
2016-01-14 16:56 Reply Reply with quote Quote
Permalink 0 Murali
Hi,

Is there any formula to remove duplicates and replace it with another values in the same sheet
2017-02-21 06:49 Reply Reply with quote Quote

Add comment


Security code
Refresh