# Thread: Specifying range height for AVERAGE function? (Excel 2002)

1. ## Specifying range height for AVERAGE function? (Excel 2002)

Suppose I want to calculate averages where the number of cells to be averaged will vary. Is there a way to tell Excel formulaically that I want to average only X number of cells in a column?

For example, say I have a very long column of numbers, let's call them data cells. In the next column I am calculating averages. Sometimes I want to average 30 of the data cells, sometimes, 5, etc. It would be great if I could type 30 and 5 somewhere and have the average formula reference one of these, so that the formula "knows" how many cells to average. Is this possible?

2. ## Re: Specifying range height for AVERAGE function? (Excel 2002)

Let's say that you want to compute the average of the first n items in column A i.e. of A1:An where n is variable.
Enter the value of n in - for example - cell C1.
The following formula will return the average:

=AVERAGE(INDIRECT("A1:A"&C1))

If the range doesn't begin in row 1, you'll have to adjust the formula.

3. ## Re: Specifying range height for AVERAGE function? (Excel 2002)

Hans to the rescue, as always!

Thanks my friend

Lingayi

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•