Page 369 - Excel 2007 Bible
P. 369
22_044039 ch17.qxp 11/21/06 11:08 AM Page 326
Part II
Working with Formulas and Functions
You can, of course, use the TRANSPOSE function to transpose an array stored in a range. The following for-
mula, for example, uses an array stored in A1:C4 (four rows, three columns). You can enter this array for-
mula into a range that consists of three rows and four columns.
{=TRANSPOSE(A1:C4)}
FIGURE 17.12
Using the TRANSPOSE function to transpose a rectangular array.
Generating an array of consecutive integers
As you can see in Chapter 18, generating an array of consecutive integers for use in an array formula is
often useful. The ROW function, which returns a row number, is ideal for this. Consider the array formula
shown here, entered into a vertical range of 12 cells:
{=ROW(1:12)}
This formula generates a 12-element array that contains integers from 1 to 12. To demonstrate, select a
range that consists of 12 rows and one column and enter the array formula into the range. You’ll find that
the range is filled with 12 consecutive integers (as shown in Figure 17.13).
If you want to generate an array of consecutive integers, a formula like the one shown previously is good —
but not perfect. To see the problem, insert a new row above the range that contains the array formula. Excel
adjusts the row references so that the array formula now reads
{=ROW(2:13)}
The formula that originally generated integers from 1 to 12 now generates integers from 2 to 13.
For a better solution, use this formula:
{=ROW(INDIRECT(“1:12”))}
This formula uses the INDIRECT function, which takes a text string as its argument. Excel does not adjust
the references contained in the argument for the INDIRECT function. Therefore, this array formula always
returns integers from 1 to 12.
CROSS-REF Chapter 18 contains several examples that use the technique for generating consecutive
CROSS-REF
integers.
326

