Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Build an Array of Different Values From Column

How can I build an array with non repeating values from a column? For
example, in Col. A I have this:

Col. A
1
2
3
3
3
4
4

I want MyArray = Array(1,2,3,4). No duplications. Can I use the Split
Function?

MyArray = Split(MyRange, "", 1, ) ' this doesn't work, Err: Type Mismatch

Thanks in Advance!
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Build an Array of Different Values From Column

Hello Ryan,

Split splits a string, not a range.

I suggest to use Lfreq or another of my UDF's I provide:
http://sulprobil.com/html/listfreq.html

Regards,
Bernd
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Build an Array of Different Values From Column

Something like this would work. It's not very pretty:

Sub arraymaker()

Dim rng As Range
Set rng = Range("A1:A13")

Dim aResult() As String
Dim i As Integer

Dim c As Range
For Each c In rng
If WorksheetFunction.CountIf(Range("a1:" & c.Address), c) = 1 Then
ReDim Preserve aResult(i)
aResult(i) = c.Value
i = i + 1
End If
Next c

End Sub

"Ryan H" wrote:

How can I build an array with non repeating values from a column? For
example, in Col. A I have this:

Col. A
1
2
3
3
3
4
4

I want MyArray = Array(1,2,3,4). No duplications. Can I use the Split
Function?

MyArray = Split(MyRange, "", 1, ) ' this doesn't work, Err: Type Mismatch

Thanks in Advance!
--
Cheers,
Ryan

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
Build Array don Excel Programming 7 November 17th 08 03:18 PM
build up an array using formulas Kezze Excel Programming 3 March 1st 05 04:57 PM
build up an array using formulas Kezze Excel Discussion (Misc queries) 0 February 15th 05 02:17 PM
build up an array using formulas Kezze Excel Discussion (Misc queries) 0 February 15th 05 02:15 PM
build array of columns Cesar Zapata[_2_] Excel Programming 0 October 12th 04 12:05 AM


All times are GMT +1. The time now is 04:20 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"