18.11.2014 Views

Microsoft Office

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Part II<br />

Working with Formulas and Functions<br />

One-dimensional vertical arrays<br />

The elements in a one-dimensional vertical array are separated by semicolons. The following is a sixelement<br />

vertical array constant:<br />

{10;20;30;40;50;60}<br />

Displaying this array in a range requires six cells in a column. To enter this array into a range, select a<br />

range of cells that consists of six rows and one column. Then enter the following formula, followed by<br />

Ctrl+Shift+Enter:<br />

={10;20;30;40;50;60}<br />

The following is another example of a vertical array; this one has four elements:<br />

{“Widgets”;”Sprockets”;”Doodads”;”Thingamajigs”}<br />

Two-dimensional arrays<br />

A two-dimensional array uses commas to separate its horizontal elements and semicolons to separate its<br />

vertical elements. The following example shows a 3 × 4 array constant:<br />

{1,2,3,4;5,6,7,8;9,10,11,12}<br />

Displaying this array in a range requires 12 cells. To enter this array into a range, select a range of cells that<br />

consists of three rows and four columns. Then type the following formula, followed by Ctrl+Shift+Enter:<br />

={1,2,3,4;5,6,7,8;9,10,11,12}<br />

Figure 17.3 shows how this array appears when entered into a range (in this case, B2:E4).<br />

If you enter an array into a range that has more cells than array elements, Excel displays #N/A in the extra<br />

cells. Figure 17.4 shows a 3 × 4 array entered into a 10 × 5 cell range.<br />

Each row of a two-dimensional array must contain the same number of items. The array that follows, for<br />

example, isn’t valid, because the third row contains only three items:<br />

{1,2,3,4;5,6,7,8;9,10,11}<br />

Excel doesn’t allow you to enter a formula that contains an invalid array.<br />

FIGURE 17.3<br />

A 3 × 4 array entered into a range of cells.<br />

318

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!