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 Populating Third Dimesion Based on Average of three elements of Third Dimension

I have a 3D array I populate the first and second dimension with rando
numbers (i.e. all rows and columns). I continue doing this into th
third element of the third dimension. For the 4th and 5th elements o
the third dimsions I only want to populate the rows and columns if
certain criteria is met. Otherwise make the value = 0.

(1,1,4) = Rnd() if the average of (1,1,1) to (1,1,3) is < .5 . I wan
to average across the 3rd dimension for the rows and columns. Thi
would be tantamount to averaging specific cells across three differen
sheets.

How do you do this?

Sub Thing()
Dim Array1() As Variant
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

ReDim Array1(1 To 4, 1 To 3, 1 To 5)

'Populate 4 rows and 3 columns of top 3 layers with random numbers
For Z = 1 To 3
For X = 1 To 4
For Y = 1 To 3
Array1(X, Y, Z) = Rnd()
Next Y
Next X
Next Z


'Populuate remaining layers ( 4 and 5 )if the x values in 1-3 element
of third dimension Average<.5
For Z = 4 To 5
For X = 1 To 4
For Y = 1 To 3
If .........Then 'Average across
Array1(X, Y, Z) = Rnd()
Else
Array1(X, Y, Z) = 0
Next Y
Next X
Next

--
Message posted from http://www.ExcelForum.com

 
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
Populating a cell based on a range of values akkrug New Users to Excel 2 June 20th 08 03:09 PM
Help with If-Then Statements/Populating Data based upon selection SK Excel Discussion (Misc queries) 1 April 13th 07 09:06 PM
Excel 2007 PivotTable "arbitrary shape is not allowed when its elements cross a reference dimension" Michael Excel Discussion (Misc queries) 0 July 20th 06 06:00 PM
Populating cells based on calculation Chris Excel Worksheet Functions 0 November 8th 04 01:22 PM
Combobox populating based on Option Button Todd Huttenstine[_2_] Excel Programming 7 November 9th 03 10:18 PM


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