Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Unique numbers in array



Hi

I have an array that contains about 200 numbers and I need to check so
the array onley contains unique numbers. If it contains double I want to
remove them.

How do I do that in an easy way?

Thanks in advance


*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Unique numbers in array

Hi,

How do I do that in an easy way?


Can we see the code that creates this array?

Mike


"Kalle" wrote:



Hi

I have an array that contains about 200 numbers and I need to check so
the array onley contains unique numbers. If it contains double I want to
remove them.

How do I do that in an easy way?

Thanks in advance


*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Unique numbers in array


It come from a datebase question
arr = split(rs.fields(0), ",")

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Unique numbers in array

Hi

One quick and dirty way:

Sub test()
MsgBox Uniques("1,2,3,3,3,4,5,4,3,56,12,56", ",")
End Sub

Function Uniques(strData As String, _
strDelimiter As String) As String
Dim C As Collection
Dim AR() As String
Dim i As Long
AR = Split(strData, strDelimiter)
Uniques = ""
Set C = New Collection
On Error Resume Next
For i = LBound(AR) To UBound(AR)
C.Add AR(i), AR(i)
Next
For i = 1 To C.Count
Uniques = Uniques & C(i) & ","
Next
Uniques = Left$(Uniques, Len(Uniques) - 1)
Set C = Nothing
End Function


HTH. Best wishes Harald
"Kalle" wrote in message
...

It come from a datebase question
arr = split(rs.fields(0), ",")

*** Sent via Developersdex http://www.developersdex.com ***


Reply
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
Count equal numbers as unique numbers auyantepui Excel Discussion (Misc queries) 7 March 1st 09 10:28 PM
unique values in an array [email protected] Excel Programming 20 January 17th 08 09:18 PM
unique values to array Gary Keramidas Excel Programming 4 November 6th 06 02:31 PM
how to extract unique numbers once from a list of repeated numbers? [email protected] Excel Discussion (Misc queries) 2 May 2nd 06 04:17 PM
Non-unique elements in an array Andrew Excel Discussion (Misc queries) 1 August 22nd 05 11:58 AM


All times are GMT +1. The time now is 11:39 PM.

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

About Us

"It's about Microsoft Excel"