LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default can I use WorksheetFunctions ON arrays from VBA??


Hi,

*i hope someone out there can understand the convoluted explanatio
i've written below... but, to cut to the chase, i'm looking to use
worksheetfunction (like countif & average) on part or all of an array
is that even possible or, if not, what alternatives do i have???*

I have a huge amount of data that excel is unwilling to store for m
(very long numbers in 10,000columns x 10,000rows) so I've decided t
move it all into an array so that I can summarise it from there. And
couldn't save it as an array matrix of 10000x10000 elements because
don't know how to reference a specific _range_ of elements within th
array [as you would a range of cells on a sheet... e.g. Range(A1:A3) o
Range(Cells(1,1),Cells(3,1))].

So my solution was to save each 'column' of data into its own singl
dimension array (since I only need to access the 'columns' as a whole
not certain parts of them) and then save each of those arrays as one o
the 10000 elements in an 'umbrella array' (i.e. an array of arrays). Fo
example (tho this obviously isn't a very efficient example):

Code
-------------------
'first fill each of the 'column' arrays
arr1 = (1,2,3...,10000)
arr2 = (1,2,3...,10000)
.....
arr10000 = (1,2,3...,10000)
'then move each of those into the 'umbrella array' in turn
umbArr(1) = arr1
umbArr(2) = arr2
....
umbArr(10000) = arr1000
-------------------

You see, doing this lets me refer to the element arr2(513) by sayin
umbArr(2)(513). And I thought that it would also let me use th
'columns' (arr1, arr2 etc) from WITHIN WorksheetFunctions. But it's no
working...

Specifically, I need to calculate the number of elements in eac
'column' of the matrix (=each arr1-arr10000 array) that equal or excee
the first element in that array. If I were dealing with cells on
worksheet, then I could use something like:

Code
-------------------
NumExtreme = WorksheetFunction.CountIf(Range(Cells(1,2),Cells(1 0000,2)),Range(1,2)) + WorksheetFunction.CountIf(Range(Cells(1,2),Cells(1 0000,2)), "" & Range
-------------------

But VBA won't let me do this:

Code
-------------------
NumExtreme = WorksheetFunction.CountIf(arr2, arr2(1)) + WorksheetFunction.CountIf(arr2, "" & arr2(1)
-------------------
Or this:

Code
-------------------
NumExtreme = WorksheetFunction.CountIf(umbArr(2), umbArr(2)(1)) + WorksheetFunction.CountIf(umbArr(2) , "" & umbArr(2)(1)
-------------------

So, other than temporarily loading all of those values into a workbook
using a CountIf on the cells, and then erasing those cells once I have
result, I don't know how to solve this dilemma... I'm stuck :(

Any suggestions you can give would be most appreciated.
Thanks so much,

--
fer
-----------------------------------------------------------------------
fern's Profile: http://www.excelforum.com/member.php...nfo&userid=985
View this thread: http://www.excelforum.com/showthread.php?threadid=39372

 
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
excel.worksheetfunctions Max Excel Worksheet Functions 13 November 26th 05 02:25 AM
No VBA help for Worksheetfunctions available Toppers Excel Worksheet Functions 4 January 23rd 05 04:58 PM
Arrays Lacy Excel Programming 3 June 8th 04 07:15 PM
Arrays Zootrot Excel Programming 1 June 4th 04 11:47 AM
Using WorksheetFunctions in Excel Macros Ken[_18_] Excel Programming 2 March 2nd 04 05:05 PM


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