highlight duplicates permanently

overbet

Board Regular
Joined
Jul 9, 2010
Messages
63
Office Version
  1. 2010
I have a large sheet that contains a lot of duplicate values that need to be looked at then possibly removed. When I use the conditional format tool to highlight duplicates I can manually go through and determine if they should be kept or deleted. The problem is because the sheet is so large when I delete a cell Excel becomes unresponsive for a few minutes. I tried turning calculation off but that doesnt fix it. Is is possible to highlight the duplicate values permanently without conditional formatting?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
There are ways of highlighting duplicate values without conditional formatting.

For example, with a very simple set of data like this in cells A1:A3 . . .

A
B
A

Insert a formula like this into B1 and copy down

Code:
=if(countif(a$1:a$3,a1)>1,"Duplicate","")
 
Upvote 0
In both cases, their will be a big calculation hit if your row count is high.
With the Conditional format, you could let conditional format work. Then use auto-filter to filter for that color, then apply a regular fill to those cells. Then remove the conditional formatting to regain performance.
The same would be true to the formula suggested, but you have better control over when the calculation runs.

The formula method Gerald Higgins suggest also is beneficial because formatting is not data. Having "Duplicate" listed for each row is far more useful as it can be used in other reporting tool such as Pivot Tables.
Copy>Paste Special>Values may occasionally have use too.
 
Upvote 0
you can use this code (in this case column I)
Code:
Sub Highlight_Duplicate()
        Dim cel As Variant
        Dim myrng As Range
        Dim clr As Long

        Set myrng = Range("I2:I" & Range("i65536").End(xlUp).Row)
        myrng.Interior.ColorIndex = xlNone
        clr = 36
        For Each cel In myrng
           If Application.WorksheetFunction.CountIf(myrng, cel) > 1 Then
              If WorksheetFunction.CountIf(Range("I2:I" & cel.Row), cel) = 1 Then
                 cel.Interior.ColorIndex = clr
                 clr = clr + 1
              Else
                 cel.Interior.ColorIndex = myrng.Cells(WorksheetFunction.Match(cel.Value, myrng, False), 1).Interior.ColorIndex
              End If
          End If
       Next
       
    End Sub
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top