KLUDGE FIX Speed this section of code

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
Problem, I need to identify exact duplicates so I can remove them

I have
Code:
    Application.ScreenUpdating = False
    With ActiveSheet
        .Range("AM2").FormulaR1C1 = _
        "=IF(COUNTIF(R2C36:R" & LR & "C36,RC[-3])>1,IF(COUNTIF(R2C[-3]:RC[-3],RC[-3])=1,"""",""Duplicate""),"""")"
        .Range("Am2").Select
        Selection.AutoFill Destination:=.Range("Am2:Am" & LR)
        .Range("Am2:Am" & LR).Select
    End With
    Application.ScreenUpdating = True

=IF(COUNTIF($AJ$2:$AJ$67596,AJ9)>1,IF(COUNTIF(AJ$2:AJ2,AJ2)=1,"","Duplicate"),"")

but it is currently doing over hundred thousand rows, and as its volatile its taking forever (well tens of minutes)

any quick fix that would do the same but place the static value DUPLICATE in the right place. I've tried multiple different ways, this worked on small test sets. I can then get on with working with the cut down data

Pretty Please :)
 
my final working for the whole 105 thousand rows to 6500 plus cf etc now times at 9 seconds, not even enough time to make a drink now, thanks to everyone for the thoughts and offerings
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
@ Rick Removeduplicates and advanced filter delete/hide duplicates starting from 2nd occurrence up. If items are 1, 1, 2 both will give 1, 2.
my final working for the whole 105 thousand rows to 6500 plus cf etc now times at 9 seconds, not even enough time to make a drink now, thanks to everyone for the thoughts and offerings
Okay, so then my code duplicates RemoveDuplicates. I wonder how my code compares with RemoveDuplicates time-wise? I'm sure its slower, but I would be curious how much slower.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,743
Messages
6,132,466
Members
449,729
Latest member
davelevnt

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