Excel arrays :: MrExcel Message Board


 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

arrays
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

zviito
Board Regular


Joined: 18 Apr 2002
Posts: 6


Status: Offline

 Reply with quote  

This is a two part question

I have a 2D array, say TheArray(1 to 365, 1 to 1000) say 365 days in year and 1000 trees. The data input is the number of fallen leaves. I would like to:-

1 - perform calculations on the data in rows. eg say row 1 is january first would like to find average number of fallen leaves.

2 - would like to put data from array into a chart/histogram, but not sure how to do that without actually printing the whole array into a worksheet and then using cell references (which I feel is lenghty)

thanx
zviito

p.s the tree and leaf thing is just an example I am not really doing this.....

Post Fri Apr 19, 2002 6:25 am 
 View user's profile Send private message

Mark W.
MrExcel MVP


Joined: 11 Feb 2002
Posts: 7146
Location: Austin, Texas USA
Flag: Usa

Status: Offline

 Reply with quote  


quote:

On 2002-04-19 02:25, zviito wrote:
This is a two part question

I have a 2D array, say TheArray(1 to 365, 1 to 1000) say 365 days in year and 1000 trees. The data input is the number of fallen leaves. I would like to:-

1 - perform calculations on the data in rows. eg say row 1 is january first would like to find average number of fallen leaves.

2 - would like to put data from array into a chart/histogram, but not sure how to do that without actually printing the whole array into a worksheet and then using cell references (which I feel is lenghty)

thanx
zviito

p.s the tree and leaf thing is just an example I am not really doing this.....




I saw your original posting yesterday... and, couldn't understand your aversion to entering the data onto a worksheet. That being the case... why aren't you using a statisical package?

Post Fri Apr 19, 2002 11:47 am 
 View user's profile Send private message

zviito
Board Regular


Joined: 18 Apr 2002
Posts: 6


Status: Offline

 Reply with quote  

well, I am new to vba, I am only just learning how to use it (am student). The data that I have put into the array is from an iterative process so its maximum size is actually about 365 X 10000 (number of iterations).

as you can see this makes for a very large worksheet. I have put the data into a worksheet, and then manipulated it from there. I just wondered if there is an easier way to do it by just calling the data from the array without having to display it first.

I am going to try and use a for next loop on the data in the array this weekend and see how it goes.

Post Sat Apr 20, 2002 10:38 am 
 View user's profile Send private message

TsTom
MrExcel MVP


Joined: 19 Mar 2002
Posts: 2845
Location: Cincinnati, Ohio
Flag: Blank

Status: Offline

 Reply with quote  

Hi
Where is your array coming from?
From what type of file?
Obviously too many elements for one worksheet...
Seems to be an easy problem if you might care to post a little more details?
Thanks,
Tom

Post Sat Apr 20, 2002 3:01 pm 
 View user's profile Send private message Send e-mail AIM Address

zviito
Board Regular


Joined: 18 Apr 2002
Posts: 6


Status: Offline

 Reply with quote  

Thank you Tom.

Well the Array as I said before is 2D. Its maximum size is 365 (days) by 10 000 (trials/iterations)
The array is actually the result of a random number generator (using the Rnd() function in VBA). I am doing some statisitical analysis. To answer a previous question, I am not using a statistical package cause I only have a standard computer with the standard office packages (unless there is a statistical programme that I am not aware of).

1 - performing calculations on the data in rows. eg say row 1 is january first would like to find average number for January.

2 - would like to put data from array into a chart/histogram. I have just learnt how to draw a chart. (recorded a macro then studied the code) so I think if I manage to do step 1, I may then print the chart data onto a worksheet instead of the whole array, then go from there.

I was going to try and use a for next loop on the data in the array this weekend and see how it goes, but I haven't quite finised it.

Post Mon Apr 22, 2002 5:04 am 
 View user's profile Send private message

TsTom
MrExcel MVP


Joined: 19 Mar 2002
Posts: 2845
Location: Cincinnati, Ohio
Flag: Blank

Status: Offline

 Reply with quote  

Hi

You need a simple average for each of the 365 elements?



quote:


Sub Avg()
Dim TheDate As Date
Dim ThisDateAvg, e1, e2, DayTotal
Dim MyVeryLargeArray(1 To 365, 1 To 10000)
'assumes MyVeryLargeArray is loaded
For e1 = 1 To 365
DayTotal = 0
For e2 = 1 To 10000
DayTotal = DayTotal + MyVeryLargeArray(e1, e2)
Next
ThisDateAvg = DayTotal / 10000
TheDate = #12/31/2000#
TheDate = TheDate + e1
Range("A" & e1).Value = TheDate
Range("B" & e1).Value = ThisDateAvg
Next
End Sub

Tom

Post Mon Apr 22, 2002 6:09 am 
 View user's profile Send private message Send e-mail AIM Address
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.