Excel formulas that return a set of values, also known as an array, return these values to neighboring cells. This behavior is called spilling.
Formulas that can return arrays of variable size are called dynamic array formulas. Formulas that are currently returning arrays that are successfully spilling can be referred to as spilled array formulas.
Following are some notes to help you understand and use these type of formulas.
What does spill mean?
Note: Older array formulas, known as legacy array formulas, always return a fixed-size result - they always spill into the same number of cells. The spilling behavior described in this topic does not apply to legacy array formulas.
Spill means that a formula has resulted in multiple values, and those values have been placed in the neighboring cells. For example, =SORT(D2:D11,1,-1), which sorts an array in descending order, would return a corresponding array that's 10 rows tall. But you only need to enter the formula in the top left cell, or F2 in this case, and it will automatically spill down to cell F11.
Key points
-
When you press Enter to confirm your formula, Excel will dynamically size the output range for you, and place the results into each cell within that range.
-
If you are writing a dynamic array formula to act on a list of data, it can be useful to place it in an Excel table, then use structured references to refer to the data. This is because structured references automatically adjust as rows are added or removed from the table.
-
Spilled array formulas are not supported in Excel tables themselves, so you should place them in the grid outside of the Table. Tables are best suited to holding rows and columns of independent data.
-
Once you enter a spilled array formula, when you select any cell within the spill area, Excel will place a highlighted border around the range. The border will disappear when you select a cell outside of the area.
-
Only the first cell in the spill area is editable. If you select another cell in the spill area, the formula will be visible in the formula bar, but the text is "ghosted", and can't be changed. If you need to update the formula, you should select the top-left cell in the array range, change it as needed, then Excel will automatically update the rest of the spill area for you when you press Enter.
-
Formula overlap - Array formulas can't be input if there is anything blocking the output range. and if this happens, Excel will return a #SPILL! error indicating that there is a blockage. If you remove the blockage, the formula will spill as expected. In the example below, the formula's output range overlaps another range with data, and is shown with a dotted border overlapping cells with values indicating that it can't spill. Remove the blocking data, or copy it somewhere else, and the formula will spill as expected.
-
Legacy array formulas entered via CTRL+SHIFT+ENTER (CSE) are still supported for back compatibility reasons, but should no longer be used. If you like, you can convert legacy array formulas to dynamic array formulas by locating the first cell in the array range, copy the text of the formula, delete the entire range of the legacy array, and then re-enter the formula in the top left cell. Before upgrading legacy array formulas to dynamic array formulas, you should be aware of some calculation differences between the two.
-
Excel has limited support for dynamic arrays between workbooks, and this scenario is only supported when both workbooks are open. If you close the source workbook, any linked dynamic array formulas will return a #REF! error when they are refreshed.
Need more help?
You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.
No comments:
Post a Comment