Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an excel file and I need to find the repetations of data in a column ...

I am Comparing a single string with each data of that column and finding for a match and it's working fine for small column datas..

But the problem is that as there are larger data in a column (say 2000 rows) the program is taking longer time for execution than expected.

Can anyone suggest me any simpler time saving method to quickly find for repetations in a excel file...

I hope U understand.

SQL
For Rep As Integer = 1 To 100
                    Obj = CType(range.Cells(Rep, cCnt), Range)
                    If Obj.value <> Nothing Then
                        arr1 = Obj.value
                    Else
                        arr1 = "NL"
                    End If
                    For Rep1 As Integer = Rep + 1 To 100
                        Obj = CType(range.Cells(Rep1, cCnt), Range)
                        If Obj.value <> Nothing Then
                            arr2 = Obj.value
                        Else
                            arr2 = "NL"
                        End If
                        If arr1.Equals(arr2) Then
                            Comp += 1
                        End If
                        
                    Next
                Next


From the comp value I am determining whether data is repeted or not
Posted

1 solution

Try sorting your data first. This can boost performance by breaking your inner loop as soon as data changes.
 
Share this answer
 
Comments
Be Yourself 7-Nov-10 3:43am    
Which type of sorting should I Use to reduce the Execution time??
Quick Sort or Radix Sort or Bubble Sort???
dmageiras 7-Nov-10 6:53am    
quick sort is faster than bubble sort, but I suggest you to use excel embedded sorting

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900