arrays

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Arrays

Arrays

resolvedResolved · Low Priority · Version 2003

Sally has attended:
Excel Advanced course

Arrays

What is the purpose of an array? I've looked them up online and I am not sure what they are for, can they help in reducing the size of files?

RE: Arrays

Hi Sally

In computer terms an array is a data structure consisting of elements that are accessed by indexing.

So Arrays make it possible to refer to a series of variables by the same name and to use an index to tell them apart.

This helps create smaller and simpler code by using loops that deal efficiently with any number of cases by using the index number. This usually speeds up the running of the program.

Arrays are useful when you must store a number of values of the same type, but you do not know how many, or you do not want to create individual variables to store them all.

The indexing in an array by default begins at 0 so declaring an array as

Dim SalesYear(5) as Integer


will allow you to store 6 years (0 t0 5)

Then in the code SalesYear(3) will return the value stored in that section of the array. This is refered to a Static array

You can also program a dynamic array. I this case you define the array but not the size. This can be defined later as seen below:

Dim SalesYear as Integer

ReDim SalesYear (1 To 20)


NB You can change the size of a dynamic array, but not the data type

Hope this helps

Regards

Carlos

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Copying Values Without Formulas in Excel 2010

If you want to copy the contents of a cell but don't want to copy the formula with it then use the following simple method:

Press Ctrl+C to copy the values in the cell. On the Home tab, click Paste and then click Paste Values.

View all Excel hints and tips


Server loaded in 0.1 secs.