LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default removing early duplicates

Since you have an algorithm in mind, you can easily adapt this sample code
from John Walkenbach's site to do this:

http://j-walk.com/ss/excel/tips/tip47.htm

--
Regards,
Tom Ogilvy


"Mike" wrote in message
...
This is great! Do you have any idea how to implement
this in a way like Microsoft's inherent "Advanced Filter"
function?

One way I think this can be more efficient is:
1. Insert counter
2. Sort list be entries by (A) entry (B) reverse counter
3. Remove duplicates besides the first
4. Resort by counter
5. Post into desired cells

Thanks!
Mike


-----Original Message-----
One, inefficient, way:

Public Function RemoveEarlyDups(ByRef rIn As Range)

As Variant
Dim vTemp As Variant
Dim vOut As Variant
Dim vUnique As Variant
Dim i As Long
Dim j As Long
Dim k As Long

If rIn.Columns.Count 1 Then
RemoveEarlyDups = CVErr(xlErrRef)
Else
vTemp = rIn.Value
ReDim vUnique(1 To UBound(vTemp, 1))
k = UBound(vUnique)
For i = UBound(vTemp, 1) To 2 Step -1
If Not IsEmpty(vTemp(i, 1)) Then
vUnique(k) = vTemp(i, 1)
k = k - 1
For j = i - 1 To 1 Step -1
If vTemp(j, 1) = vTemp(i, 1)

Then _
vTemp(j, 1) = Empty
Next j
End If
Next i
j = 1
ReDim vOut(k + 1 To UBound(vUnique))
For i = k + 1 To UBound(vUnique)
vOut(i) = vUnique(i)
Next i
RemoveEarlyDups = Application.Transpose(vOut)
End If
End Function


this returns an array of unique values


In article ,
"Mike" wrote:

Can anyone help me with a UDF to remove early

duplicates
from a list?

Example:
Input:
A
B
A
C
B

Output:
A
C
B

Thanks,
Mike

.



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Duplicates Help Scott Excel Discussion (Misc queries) 6 May 5th 09 03:58 AM
Removing duplicates Tdp Excel Discussion (Misc queries) 6 November 27th 08 12:33 AM
Removing Duplicates Danielle Excel Worksheet Functions 5 March 10th 06 07:56 PM
removing duplicates robhargreaves Excel Discussion (Misc queries) 1 July 24th 05 12:35 AM
Removing Duplicates sat Excel Discussion (Misc queries) 5 June 18th 05 11:18 PM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"