Well, the question is that I have a column, for example, column Y has many records in it, about 40,000, and it grows every time. The thing is, I have to check for duplicates in column Y and delete the whole row. Thus, column Y should only have unique records.
Suppose I have 3000 records, and after 1 week I will have about 3500 records. Now I have to check these newly added 500 column values, not 3500 with old + new ie 3500 records and delete the duplicate row. Old 3000 should not be deleted or changed. I found macros, but they do the trick for the entire column. I would like to filter out the new 500 values.
Cells(2, "Q").Formula = "=COUNTIF(P$1:P1,P2)=0" 'I have used these formula Range("Q2").Copy Destination:=Range("Q3:Q40109") 'it gives false for the duplicate values
I know that we should use countif for duplicate entries. But what I do is apply the formula, and then search for the false entries and then delete them. I believe that you apply the formula and find the lie, and then remove it a little time.
Sub DeleteDups() Dim x As Long Dim LastRow As Long LastRow = Range("A65536").End(xlUp).Row For x = LastRow To 1 Step -1 If Application.WorksheetFunction.CountIf(Range("A1:A" & x), Range("A" & x).Text) > 1 Then Range("A" & x).EntireRow.Delete End If Next x End Sub
This is what I found on google, but I do not know where the error is. It removes all columns if I set
For x = LastRow To 1 Step -1 For x = LastRow to step 3000 ' It is deleting all 500 columns but if it is -1 working fine
Any changes must be made to these functions? or I really liked any good feature that helps me. Check for duplicate values ββfor the selected range of columns from the entire column. I mean, check 500 queries the column values ββwith the record values ββof column 3500 and removes duplicates of 500 records.
Thank you in advance