![]() |
newbie question on multi-dimensional array
Hi all, I have a real lame question about multi-dimensional array operation. Suppose I have defined a two-dimensional array "Array(10,10)". If I want to use the Excel function "Average" to compute the average value of Column, say 10, of that 2D array, is there any way to realize it? I tried "Application.Average(Array(:,10))", but apparently the Excel doesn't like that. (You can see I am a Matlab guy, so please don't laugh at me:) ) Any comments are extremely welcome. -- sammus ------------------------------------------------------------------------ sammus's Profile: http://www.excelforum.com/member.php...o&userid=33092 View this thread: http://www.excelforum.com/showthread...hreadid=529036 |
newbie question on multi-dimensional array
s,
'--------------------- Sub ArrayTest() Dim i As Long Dim j As Long Dim arrNums() As Double Dim arrCol As Variant '11 columns ReDim arrNums(0 To 10, 0 To 10) 'Fill the array For i = 0 To 10 For j = 10 To 0 Step -1 arrNums(i, j) = i + j Next Next 'If you set row_num or column_num to 0 (zero), then 'Index returns the array of values for the entire column or row arrCol = Application.Index(arrNums, 0, 10) 'next to last column MsgBox Application.Average(arrCol) End Sub '------------ Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "sammus" wrote in message... Hi all, I have a real lame question about multi-dimensional array operation. Suppose I have defined a two-dimensional array "Array(10,10)". If I want to use the Excel function "Average" to compute the average value of Column, say 10, of that 2D array, is there any way to realize it? I tried "Application.Average(Array(:,10))", but apparently the Excel doesn't like that. (You can see I am a Matlab guy, so please don't laugh at me:) ) Any comments are extremely welcome. sammus |
newbie question on multi-dimensional array
Thank you so much for your enlightening reply. :) -- sammus ------------------------------------------------------------------------ sammus's Profile: http://www.excelforum.com/member.php...o&userid=33092 View this thread: http://www.excelforum.com/showthread...hreadid=529036 |
All times are GMT +1. The time now is 08:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com