Dynamic Arrays and Modern Functions
IntermediateLesson 6 of 7 in Spreadsheet Formulas and Functions Course
What you will learn
- Explain how one formula can return a whole list of results into neighboring cells, refer to that list with the spill range operator, and prevent or fix #SPILL! errors.
- Read how a formula spills into neighboring cellsRecognize formulas that return several values, find the anchor cell and the spill range, and predict where and how far a result spills.
- Refer to a spilled list with the # operatorUse the spill range operator to point other formulas at a whole spilled result, at any size, and pick single columns from it.
- Prevent and fix #SPILL! errorsRead the reason behind a #SPILL! error, clear what blocks the result, and place spilling formulas where they have room to grow.
- Read how a formula spills into neighboring cells
- Build lists that show only the rows meeting one or more conditions and update themselves when the data or the criteria change.
- Return the rows that meet one conditionWrite FILTER formulas with one condition, drive them from a criteria cell, choose the columns returned, and handle results with no matches.
- Combine several conditions in one filterJoin conditions with AND and OR logic, match part of a text or a list of values, and let an empty criterion cell show every row.
- Return the rows that meet one condition
- Sort lists by one or more keys with SORTBY, including keys that are not shown, and create numbered lists, date series and grids with SEQUENCE.
- Sort a list by one or more columns with SORTBYSort rows by separate key ranges, in ascending or descending order, with tie-breaking keys, calculated keys and custom orders.
- Generate numbers and dates with SEQUENCECreate number series, countdowns, date lists and grids with SEQUENCE and size them from other results.
- Sort a list by one or more columns with SORTBY
- Nest dynamic-array functions so one formula filters, sorts, trims and summarizes data, and lay out reports that update when the data or a choice changes.
- Nest FILTER, SORTBY and other functions in one formulaUse one dynamic array as the input of another, sort filtered results with matching keys, and summarize filtered lists.
- Return top results and chosen columnsKeep the first or last rows of a sorted result, choose and reorder columns, stack results with headings, and use INDEX with SEQUENCE where the newer functions are missing.
- Lay out a live report on a worksheetCombine a data table, input cells, drop-down lists, headings, totals and spilling formulas into a report that stays correct as data grow.
- Nest FILTER, SORTBY and other functions in one formula
- Name the steps of a long formula with LET so it is shorter, faster and easier to check, and turn repeated calculations into custom functions with LAMBDA.
- Name values inside a formula with LETWrite LET formulas that assign names to values and expressions, follow the rules for names, and check the steps one at a time.
- Rewrite a long dynamic-array formula with LETFind repeated parts of a nested formula, replace them with names, and keep the result identical while the formula gets shorter and clearer.
- Write and test a LAMBDA functionDefine a custom calculation with parameters, test it in a cell with sample inputs, and know how LAMBDA works with ranges, LET and helper functions.
- Save a LAMBDA as a named function and reuse itStore a tested LAMBDA under a name in Name Manager, call it like a built-in function across the workbook, and maintain it in one place.
- Name values inside a formula with LET
- Know which Excel versions run each function, recognize how older versions and Google Sheets treat these formulas, and adapt a workbook before sharing it.
- Check which Excel versions support each functionMatch each function to the versions that have it, read legacy array formulas and the @ operator, and prepare workbooks for users of older versions.
- Adapt dynamic-array formulas for Google SheetsRecognize where Google Sheets handles arrays differently and rewrite FILTER, SORTBY and spill references so they work there.
- Check which Excel versions support each function
Dynamic Arrays study guide
1Let one formula fill a range
A formula can return a whole column or grid, with Excel placing each value in its own cell. Understanding where that result starts, how it changes size, and what can block it makes the later filtering and reporting formulas much easier to build. You will follow a spill from its anchor, connect other calculations to its current size, and use the error message to find the right fix when the result cannot appear.
1.1 One formula, many cells
A dynamic array formula can return several values. Excel places them in neighboring cells, starting where you entered the formula and continuing below or to the right. This is called spilling. The result occupies a rectangular spill range.
Find the formula's home
The top-left cell is the anchor. It contains the formula and the first result. Click any result cell to see a thin border around the spill range. In cells other than the anchor, the formula bar shows a grayed-out copy of the formula. Edit the anchor to change the whole result.
Enter =A2:A9 in G2. Eight source cells produce eight results in G2:G9. Entering =SEQUENCE(5) produces five numbers down a column. A range calculation also spills: =D2:D9*1.1 returns eight amounts, each multiplied by 1.1.
Multiply matching rows
Suppose B2:B6 contains quantities and C2:C6 contains unit prices. Enter =B2:B6*C2:C6 once in D2.
- Excel pairs B2 with C2, B3 with C3, and so on.
- Each pair produces one line total.
- The five totals fill D2:D6. A quantity of 4 at a price of 2.5 gives 10 in that row.
Do not copy this formula down. A copy in D3 would occupy a cell the first formula needs, causing a #SPILL! error. A single spilling formula keeps the calculation the same across all five rows.
Predict the shape
Two equally sized columns combine position by position. A single number is reused at every position, as with the multiplier 1.1. Excel can also repeat a single row across rows, or a single column across columns. For example, =SEQUENCE(3)*SEQUENCE(1,4) combines the column 1, 2, 3 with the row 1, 2, 3, 4. The result is a 3-by-4 multiplication grid: its final row is 3, 6, 9, 12.
Arrays with incompatible lengths do not simply stop at the shorter array. A five-row column multiplied by a three-row column gives #N/A in positions with no partner. Check both the height and width of the inputs when a result's shape is unexpected.
Leave room for change
A spill follows the size of the formula's result. If a source change makes a FILTER return six rows instead of four, Excel expands the spill at the next calculation. If fewer rows qualify, it shrinks. A fixed source reference such as A2:A9 still reads only those cells; automatic output resizing does not make that source reference grow.
Formatting stays with worksheet cells. A list of dates that expands into unformatted cells can show day numbers there. March 2, 2026, is stored as 46083 in Excel's standard 1900 date system. Apply a date format to the area the list can reach, including future rows. Spilling is available in Microsoft 365, Excel 2021, Excel 2024, Excel for the web, and the Excel mobile apps.
Key Takeaways
- The anchor is the top-left cell and the only cell where you edit the spilling formula.
- A range reference or a calculation on ranges can spill, as well as an array-returning function.
- Array calculations pair positions and can expand a single row or column across another array.
- Enter a spilling formula once and leave its output area free.
- The result resizes; cell formatting and fixed source references do not resize with it.
1.2 Follow a list with the spill operator
A result that changes size needs a reference that changes with it. The spill range operator, #, means the whole current spill starting at the address immediately before it.
Start from the anchor
With =SEQUENCE(10) in A2, the numbers 1 through 10 fill A2:A11. The reference A2# means that entire block. In another clear area, =SUM(A2#) returns 55.
Now change the anchor formula to =SEQUENCE(20). The result grows to A2:A21, and the same SUM returns 210. A fixed reference to A2:A11 would still add only the first ten cells. A fixed range can also include cells no longer occupied after a spill shrinks.
Write the operator after the cell address: A2#. The address identifies the formula that produces the list; the operator asks Excel for that formula's complete current output. For a spill on another sheet, the anchor still determines which list the reference follows.
Measure a two-dimensional result
Suppose G2 contains =FILTER(A2:D9,B2:B9="North"). The result has three rows and four columns.
=ROWS(G2#)returns 3.=COLUMNS(G2#)returns 4.- Entering
=G2#in another empty area reproduces all three rows and four columns.
The operator refers to the whole rectangle, not just the first column. This matters when you need an amount total from a report that also contains names, regions, and products.
Pick a column with INDEX
INDEX can return an entire column when its row argument is 0. The fourth column of this report holds amounts, so use:
=INDEX(G2#,0,4)
It returns 420, 650, and 275 as a column. To add those amounts without displaying a separate column, put the expression inside SUM:
=SUM(INDEX(G2#,0,4))
The total is 1345. The 4 counts columns within the spill, starting with its leftmost column. It does not mean worksheet column D. If you later change the report to return different columns, check that this position still identifies the amounts.
Recognize reference errors
A # reference must name an anchor. If G3 is just the second row of the G2 spill, G3# returns #REF!. An ordinary value in B2 also cannot be addressed as B2#. Click inside a spill, find its top-left cell, and use that address. When selecting a whole spill while building a formula, Excel can enter the spill reference for you.
Spill references work with functions that accept the resulting input; they do not remove a function's own shape or input rules. A single-column requirement still needs a single column, which INDEX can supply.
A spill reference to another workbook needs that source workbook to be open. If it is closed, the linked formula returns #REF! when refreshed. Reopen the source to restore the live link, or share a separate copy of the results as values when a live connection is unnecessary.
Key Takeaways
- Write # after the anchor address to follow the entire current spill.
- Use ROWS and COLUMNS to measure the result; use INDEX with row 0 to select a whole column.
- A # reference to a non-anchor returns #REF!.
- Cross-workbook spill links need the source workbook to be open.
1.3 Make space for a spilling result
#SPILL! means Excel cannot place a formula's array result on the sheet. The source data stay unchanged. Select the anchor and open the error indicator to see the reason before changing the formula.
Find an occupied cell
A value, a formula, or even a typed space can block the intended output. The error menu's Select Obstructing Cells command helps locate these cells. Move useful content elsewhere or clear it, and the result can appear.
For example, the North filter in G2 needs G2:J4 for three rows of four columns. A note in J3 blocks the whole result, including otherwise empty cells. Clearing J3 frees the spill. If another North order is later added to the source table, the result needs G2:J5. Leaving only today's output area clear is not enough for a growing report.
Formatting alone does not block a spill. A cell containing ="" looks empty but contains a formula, so it does block one. Inspect the formula bar when an apparently blank cell is in the way.
Check the worksheet layout
| Cause | What to change |
|---|---|
| Formula entered inside an Excel table | Move the output formula to an ordinary range, or convert the table to a range. |
| Merged cells in the output area | Unmerge them or move the anchor. |
| Output would cross the sheet edge | Reduce the result size or move the anchor. |
| Another growing list occupies the area | Give the lists separate columns with room below. |
An Excel table can supply the data. It cannot contain a spilling output formula in a calculated column. Keep those two roles separate when laying out a report.
Avoid asking for an entire sheet column of results
Excel has 1,048,576 rows. A formula such as =XLOOKUP(A:A,K2:K20,L2:L20) asks for a lookup for every cell in A:A. Entered below row 1, that many results would run beyond the last row. Use the actual lookup-value range or a table column to request only the required results.
The same edge rule applies horizontally: a wide array must fit before the last worksheet column. Moving a formula cannot make an array larger than the worksheet fit.
Keep the output size stable during calculation
=SEQUENCE(RANDBETWEEN(1,10)) makes the number of output rows depend on a random value. Excel may calculate again while resolving the sheet. If the size keeps changing between those passes and never settles, it returns #SPILL!. Use a stable row count, such as a number entered in an input cell. TODAY is volatile too, but it does not generate a new random size on each calculation pass.
Distinguish a blocked result from an empty one
A FILTER with no matching rows and no if_empty argument returns #CALC!. Clearing output cells will not create a match. Set an appropriate empty-result message or change the criterion. For #SPILL!, make room for the result that Excel is trying to place.
Put report totals above a growing list or beside it. A total directly beneath the current last row will become an obstruction when one more row qualifies.
Key Takeaways
- Read the #SPILL! reason in the anchor before choosing a fix.
- Values, formulas, spaces, and merged cells can obstruct output; formatting alone does not.
- Keep spilling formulas outside Excel tables, even when their sources are tables.
- Use bounded data references and leave room below and to the right.
- An unsettled random output size can cause #SPILL!.
- FILTER with no matches needs empty-result handling, not more worksheet space.
2Build lists with FILTER
A useful report often starts with a question: which rows belong in this list? FILTER answers it with one test for each source row, then returns the rows that pass. You will first connect a single condition to an input cell, then build conditions for several requirements, alternative choices, dates, and partial text. Keeping those tests lined up with the source is the key to a list that updates correctly when the data change.
2.1 Choose the rows and columns to return
FILTER returns a live copy of the data that meet a condition. Its syntax is =FILTER(array,include,[if_empty]): array is what to return, include decides what to keep, and the optional if_empty gives a result when nothing matches.
Set up the orders example
Enter these headings in A1:D1 and the eight orders in A2:D9.
| Rep | Region | Product | Amount |
|---|---|---|---|
| Ana | North | Paper | 420 |
| Ben | South | Ink | 180 |
| Chen | North | Ink | 650 |
| Dara | East | Paper | 300 |
| Eli | South | Toner | 510 |
| Fay | North | Toner | 275 |
| Gus | East | Ink | 390 |
| Hana | South | Paper | 120 |
In G2, enter =FILTER(A2:D9,B2:B9="North"). The comparison tests all eight region cells. It produces TRUE for Ana, Chen, and Fay and FALSE for the other rows. FILTER returns those three rows, with all four columns, in G2:J4. Their original order is preserved; filtering does not sort them.
Let an input cell control the list
Type "South" in H1 and change the formula to =FILTER(A2:D9,B2:B9=H1). Ben, Eli, and Hana appear. Change H1 to "East" and Dara and Gus appear. There are no quotes around H1 because it is a reference. Quotes around "H1" would test for that literal text.
The result recalculates when the input or source values change. The worksheet's Filter button hides rows in the source and may need to be reapplied after changes; FILTER creates a separate formula result.
Compare numbers, dates, and text
=FILTER(A2:D9,D2:D9>=400) returns Ana, Chen, and Eli. Use > for strictly greater than, >= to include the boundary, and <> to exclude a value. Excel stores dates as numbers, so a date condition such as A2:A50>=DATE(2026,3,1) keeps dates on or after March 1, 2026, in a date-based data set.
Text equality ignores case: "north" matches "North". It does not interpret wildcards. A comparison to "ink" looks for that exact text; use SEARCH for a partial match.
Handle no matches and choose the output
=FILTER(A2:D9,B2:B9=H1,"No orders") shows "No orders" when the region has no matching row. Without that third argument, an empty result gives #CALC!. Using "" gives an empty-looking cell instead of a visible message.
Change only the first argument to return fewer columns: =FILTER(A2:A9,B2:B9="North") returns Ana, Chen, and Fay. The tested region column need not be part of the output, but its eight tests must still match the eight data rows. B2:B10 would create a length mismatch and #VALUE!.
To keep columns, give FILTER a horizontal test: =FILTER(A1:D9,A1:D1<>"Product") returns Rep, Region, and Amount, including headings. A row of four tests selects among four columns.
With the source converted to an Excel table named Orders, =FILTER(Orders,Orders[Region]="North") also includes new table rows. Enter the result formula outside the table.
Key Takeaways
- FILTER keeps rows or columns according to a matching TRUE/FALSE array.
- The array argument chooses what is returned; the include argument chooses what qualifies.
- A criterion cell changes the list without editing the formula.
- Use if_empty to replace FILTER’s no-match #CALC! error.
- Structured references include new source-table rows.
- Match the test length to the dimension being filtered.
2.2 Combine conditions row by row
Several requirements still need one keep-or-drop result for each row. In array arithmetic, TRUE acts as 1 and FALSE as 0. Multiplication gives AND; addition gives OR. Put each comparison in parentheses.
Require both conditions
=FILTER(A2:D9,(B2:B9="South")*(D2:D9>150))
The first test asks whether each order is South. The second asks whether its amount exceeds 150. Ben passes both tests, so his include value is 1. Hana passes the region test but fails the amount test, giving 0. Ben 180 and Eli 510 are returned.
The AND function is different: AND(B2:B9="South",D2:D9>150) combines all the tests into one TRUE or FALSE. It does not supply eight separate decisions to FILTER. Use multiplication for the row-by-row requirement.
Accept either condition
=FILTER(A2:D9,(C2:C9="Ink")+(C2:C9="Toner"))
A row passes when either test contributes 1, so Ben, Chen, Eli, Fay, and Gus appear. Overlap is allowed. In (B2:B9="North")+(D2:D9>500), Chen scores 2 because both tests pass. FILTER keeps any nonzero score and returns the row once, not twice. The full result is Ana, Chen, Eli, and Fay.
For "Ink or Toner, and above 300," group the alternatives first:
=FILTER(A2:D9,((C2:C9="Ink")+(C2:C9="Toner"))*(D2:D9>300))
Chen, Eli, and Gus qualify. Without the outer parentheses around the OR group, multiplication would apply to only part of the intended test.
Include an entire month
For dates or date-times in A2:A50, use (A2:A50>=DATE(2026,3,1))*(A2:A50<DATE(2026,4,1)). This includes March 1 and every time on March 31. A test ending at midnight on March 31 would miss entries later that day. The next month's first day gives a clear exclusive upper boundary.
Match part of text or a list of choices
SEARCH("ink",C2:C9) returns a character position where the text is found and #VALUE! where it is absent. ISNUMBER turns those outcomes into TRUE and FALSE. Thus =FILTER(A2:D9,ISNUMBER(SEARCH("ink",C2:C9))) keeps Ben, Chen, and Gus, ignoring case.
To allow several region names, type "North" and "East" in K2:K3. Use =FILTER(A2:D9,ISNUMBER(MATCH(B2:B9,K2:K3,0))). MATCH searches for each region in the allowed list; 0 requests an exact match. The output is Ana, Chen, Dara, Fay, and Gus.
Give a blank input a useful meaning
=FILTER(A2:D9,(B2:B9=H1)+(H1=""))
When H1 is empty, the second test is TRUE for the whole list, so every row passes. When it contains a region, that test becomes FALSE and only matching rows remain. To exclude East in a normal condition, use B2:B9<>"East". Add an if_empty message to displayed filters when no rows can qualify.
Key Takeaways
- Use * for row-by-row AND and + for row-by-row OR.
- FILTER keeps a row once whenever its include score is nonzero.
- Parentheses control how mixed AND and OR conditions combine.
- Use an inclusive start and exclusive next-period boundary for date-times.
- ISNUMBER with SEARCH tests partial text; ISNUMBER with exact MATCH tests membership in a list.
- An added blank-input test can make an empty criterion mean all rows.
3Sort results and generate series
Sorting puts existing records in a useful order; generating a series creates values that were not listed before. SORTBY lets a separate column, a calculated key, or several priorities decide a result’s order. SEQUENCE creates numbered rows, spaced dates, and rectangular grids. Both return arrays, so you can use their results directly on the sheet or pass them into the report formulas you build next.
3.1 Keep records together while sorting
SORTBY returns a sorted copy of an array. The source stays in its original order. Its syntax is =SORTBY(array,by_array1,[sort_order1],[by_array2,sort_order2],…).
Choose the data and the key
For the orders in A2:D9, =SORTBY(A2:D9,D2:D9,-1) returns all four columns sorted by Amount, largest first. The order is Chen 650, Eli 510, Ana 420, Gus 390, Dara 300, Fay 275, Ben 180, and Hana 120. Each name moves with its region, product, and amount.
The sort key is D2:D9. A sort order of 1 means ascending and is the default. Use -1 for descending. Zero is not a valid sort order and returns #VALUE!.
Each key for a vertical list must be one column with the same height as the returned data. D2:D10 has nine values, so it cannot sort the eight rows of A2:D9. For sorting columns across a horizontal array, the key is one row with the same width as that array.
Return one field, sort by another
=SORTBY(A2:A9,D2:D9,-1) returns only the reps, from Chen through Hana. The amounts control the order but do not appear. This is useful for a list of names ranked by a score kept elsewhere. Key values are paired with data by their position, so their alignment must describe the same records.
Break ties with another key
=SORTBY(A2:D9,B2:B9,1,D2:D9,-1) sorts regions from A to Z, then sorts amounts from largest to smallest within each region:
- East: Gus 390, Dara 300.
- North: Chen 650, Ana 420, Fay 275.
- South: Eli 510, Ben 180, Hana 120.
The second key decides only ties in the first key. A large South amount does not move ahead of an East record when Region is the first priority.
Calculate a sorting key
=SORTBY(A2:A9,LEN(A2:A9)) sorts by the number of characters in each name. The three-letter names come before Chen, Dara, and Hana. To impose a custom region order, put "North", "South", and "East" in K2:K4 and use =SORTBY(A2:D9,MATCH(B2:B9,K2:K4,0)). MATCH turns those labels into ranks 1, 2, and 3. Keep every region used by the data in the custom-order list so the keys have valid ranks.
Check the values' type
Ascending puts numbers from smallest to largest, text from A to Z without regard to case, and dates from oldest to newest. A number stored as text follows text sorting rules: "100" comes before "25". Convert numeric text to numbers before expecting numeric order.
| Function | How it identifies a key |
|---|---|
=SORT(A2:D9,4,-1) | Column 4 within the returned array. |
=SORTBY(A2:D9,D2:D9,-1) | A separate range or array of values. |
Inserting a column can change what SORT's fixed position 4 means. SORTBY's reference moves with its referenced column. Edit the source data or the anchor formula to change a sorted result; its spilled cells are output cells.
Key Takeaways
- SORTBY returns a sorted copy and keeps all fields of each record together.
- Use 1 for ascending and -1 for descending; key dimensions must match the data.
- A key may be outside the returned data or calculated from it.
- Later keys break ties in earlier keys.
- Check number types and custom-order ranks when an order looks wrong.
3.2 Create number and date series
SEQUENCE generates a grid of numbers: =SEQUENCE(rows,[columns],[start],[step]). Rows controls the height, columns the width, start the first value, and step the change between consecutive values. Columns, start, and step default to 1.
Set the shape before the values
=SEQUENCE(5) creates a column containing 1 through 5. =SEQUENCE(1,5) creates one row of those values. If rows is omitted, supply another argument: =SEQUENCE(,5) also makes one row of five.
A grid fills row by row. =SEQUENCE(3,4) returns:
| Column 1 | Column 2 | Column 3 | Column 4 |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
For values running down columns first, generate the opposite shape and transpose it. =TRANSPOSE(SEQUENCE(4,3)) returns a 3-by-4 grid whose first column is 1, 2, 3. TRANSPOSE exchanges rows and columns.
Change the starting value and spacing
=SEQUENCE(1,4,10,5) starts at 10 and adds 5 each time, returning 10, 15, 20, 25. The fourth value follows three steps after the start.
A negative step counts down. =SEQUENCE(4,1,100,-25) gives 100, 75, 50, 25. A decimal step works too: =SEQUENCE(5,1,0,0.25) gives 0, 0.25, 0.5, 0.75, 1. A step of 0 repeats the starting number across the requested shape. Swapping the rows and columns arguments changes the direction of the output, not the step between values.
Generate dates from day numbers
Excel dates are stored as day numbers. =SEQUENCE(7,1,DATE(2026,3,2)) starts on Monday, March 2, 2026, and adds one day per row through Sunday, March 8. Apply a date format to the output cells. In the standard 1900 date system, the first value is 46083; formatting changes its display to a date without changing the underlying number.
To list five Mondays, use =SEQUENCE(5,1,DATE(2026,3,2),7). The dates are March 2, 9, 16, 23, and 30. For four whole Monday-to-Sunday weeks, =SEQUENCE(4,7,DATE(2026,3,2)) creates a calendar grid through March 29. A day-of-month format shows just the day in each cell.
Let formulas set the arguments
=DATE(2026,SEQUENCE(12),1) creates the first day of each month of 2026. SEQUENCE supplies month numbers 1 through 12, and DATE uses each one with the same year and day.
=SEQUENCE(ROWS(G2#)) creates row numbers beside a spilled list. A three-row list gets 1, 2, 3; a longer result gets more numbers. If G2 contains an empty-result message, ROWS counts its one message row too, so check for actual matches before using this numbering in a report.
For a user-controlled length, =SEQUENCE(B1) takes its row count from B1. Keep that count a positive whole number and give the output enough clear space. A shape argument controls how many cells are filled; a date or number format controls how their values look.
Key Takeaways
- SEQUENCE sets rows, columns, start, and step, with the last three defaulting to 1.
- A grid fills across each row before moving to the next row.
- Negative, decimal, and zero steps create countdowns, fractional spacing, and repeated values.
- Date series use numeric day steps and need date formatting.
- Formula arguments can make a series follow another result’s size.
4Turn array formulas into live reports
A report becomes easier to maintain when filtering, sorting, and selecting results form one clear calculation. The order of those steps matters: a top-results list must sort the relevant records before it cuts the list down. You will connect arrays without losing the match between rows and sort keys, choose the fields to display, and arrange tables, controls, headings, and totals so the output can grow.
4.1 Pass one array into the next function
A nested formula passes one function's result to another. Excel evaluates the inner calculation and gives its whole array to the next function. Only the final result needs space on the worksheet.
Filter the data and its sorting key together
To return North reps ranked by amount, start with =FILTER(A2:A9,B2:B9="North"). It returns Ana, Chen, and Fay. Their matching amounts come from =FILTER(D2:D9,B2:B9="North"): 420, 650, 275.
Combine those two arrays:
=SORTBY(FILTER(A2:A9,B2:B9="North"),FILTER(D2:D9,B2:B9="North"),-1)
SORTBY pairs the three names with those three amounts, sorts descending, and returns Chen, Ana, Fay. Passing the unfiltered D2:D9 as the key would pair three names with eight amounts and cause #VALUE!. The same number of rows is necessary, and the rows must also represent the same records in the same order.
Sort by a field already in the result
If you return all four columns, Amount is still column 4. =SORT(FILTER(A2:D9,B2:B9="North"),4,-1) is a shorter way to sort the North records. The result is Chen 650, Ana 420, Fay 275.
For a list already spilled in G2, use =SORTBY(G2#,INDEX(G2#,0,4),-1). INDEX extracts the fourth column from the very array being sorted, keeping the records aligned.
Reduce or condense a filtered list
An aggregate turns several values into one result. =SUM(FILTER(D2:D9,B2:B9="North")) adds 420, 650, and 275 to give 1345. =AVERAGE(FILTER(D2:D9,C2:C9="Ink")) averages 180, 650, and 390, giving about 406.67. =ROWS(FILTER(A2:D9,D2:D9>300)) counts four qualifying rows.
UNIQUE condenses repeated values. =UNIQUE(FILTER(C2:C9,D2:D9>300)) returns Paper, Ink, and Toner, in order of first appearance. =SORT(UNIQUE(B2:B9)) returns East, North, South as a sorted region list.
Match the empty result to the calculation
If FILTER finds nothing, a SUM wrapped around its #CALC! error also returns an error. Use a numeric fallback inside the filter: =SUM(FILTER(D2:D9,B2:B9=H1,0)). A region with no orders then totals 0. For a simple conditional total or count, SUMIFS or COUNTIFS can be clearer. FILTER is especially useful when the condition involves OR, partial text, or a list of allowed values.
A text message is a valid display result, but it is not a four-column data array. Do not pass "No orders" blindly into a sorting or column-selection step that expects four columns. Test whether any rows qualify before those steps.
Respect range-only arguments
Some functions accept calculated arrays; some arguments require worksheet ranges. SUM and SORTBY accept arrays directly. COUNTIF and SUMIFS require ranges for their range arguments. To use COUNTIF on calculated values, spill the list first, then refer to its cells, for example =COUNTIF(G2#,"Ink") for a single-column product list.
Build a nested formula from the inside out in a spare area. Check the filter's rows, then add the sort or aggregate. LET can give repeated steps names once the results are correct.
Key Takeaways
- Nested formulas pass complete arrays from inner functions to outer functions.
- Filter sort keys with the same condition as the returned data.
- Use SORT with a column position when the key is already in the returned array.
- Aggregates return one value; UNIQUE removes repeated values.
- Choose numeric empty results for totals and guard array-processing steps from text messages.
- Range-only arguments need actual worksheet cells, which a spill reference can supply.
4.2 Keep top rows and selected fields
A report often needs fewer rows and columns than the source. TAKE selects rows from an array, and CHOOSECOLS selects fields in the order you request. These functions, plus HSTACK and VSTACK, work in Microsoft 365 and Excel 2024.
Sort before cutting the list
=TAKE(SORTBY(A2:D9,D2:D9,-1),3) sorts every order by amount, then keeps the first three: Chen 650, Eli 510, and Ana 420. Reversing the steps would sort only the first three source records. Eli's larger order would never be considered.
The syntax is =TAKE(array,rows,[columns]). Positive rows keep records from the start. =TAKE(SORTBY(A2:D9,D2:D9,-1),-2) keeps the final two rows of the descending list, Ben 180 and Hana 120. It preserves their existing order. If you ask for five rows from a three-row list, TAKE returns all three.
A top-three list means three records. If amounts tie at the cut, it can include only one tied record. Add a meaningful second sort key to choose the order deliberately, or examine the next amount when deciding whether the report should include all tied records.
Choose and reorder columns
=CHOOSECOLS(FILTER(A2:D9,B2:B9="North"),1,4) returns only Rep and Amount: Ana 420, Chen 650, Fay 275. The syntax is =CHOOSECOLS(array,col_num1,[col_num2],…). Positions count within the supplied array, and their listed order is the output order. Asking for 4,1 would show Amount before Rep. Negative positions count from the right; -1 means the last column. Zero or a position beyond the array's width gives #VALUE!.
Build a region's top-two report
With "South" in H1:
=TAKE(CHOOSECOLS(SORTBY(FILTER(A2:D9,B2:B9=H1),FILTER(D2:D9,B2:B9=H1),-1),1,4),2)
Read outward from the innermost functions:
- FILTER keeps Ben, Eli, and Hana and their matching amounts.
- SORTBY puts Eli 510 before Ben 180 and Hana 120.
- CHOOSECOLS keeps names and amounts.
- TAKE keeps Eli and Ben.
For an input with no matches, guard the whole data-processing branch before running it, so an empty-result message does not become the array to sort or trim.
Add headings or ranks
VSTACK joins arrays vertically: =VSTACK(A1:D1,FILTER(A2:D9,B2:B9="North")) puts the headings above the North rows. HSTACK joins arrays horizontally: =HSTACK(SEQUENCE(3),TAKE(SORTBY(A2:A9,D2:D9,-1),3)) puts ranks 1, 2, 3 beside Chen, Eli, Ana. Match heights for side-by-side data and widths for stacked rows when you want a rectangle without padding errors.
Use INDEX in Excel 2021
Excel 2021 lacks these four selection and stacking functions. =INDEX(SORTBY(A2:D9,D2:D9,-1),SEQUENCE(3),{1,4}) returns the top three names and amounts. The vertical row numbers 1, 2, 3 combine with the horizontal column numbers 1 and 4. Unlike TAKE, requesting rows beyond the source result gives #REF!. Limit the row count to the available records, for example with MIN, when the list can be short.
Key Takeaways
- Sort the full relevant list before using TAKE to select top results.
- TAKE can select from either end and returns all available rows if asked for too many.
- CHOOSECOLS selects fields by position and controls their output order.
- HSTACK joins side by side; VSTACK joins top to bottom.
- A record-count cut can split ties, so choose a deliberate tie rule.
- Excel 2021 can select rows and columns with INDEX and SEQUENCE, but needs an explicit limit for short lists.
4.3 Arrange a report that can grow
A live report connects three parts: source data, input cells, and output formulas. New records or a different choice change the result at recalculation, without copying formulas or re-sorting a displayed list.
Give each part its own space
Convert the orders source to an Excel table named Orders. Its structured references grow with new rows. Orders[Region] means the table's region data; Orders[Amount] means its amounts. A fixed reference A2:D9 would miss a new order in row 10.
Keep H1 as the region input. Reserve G3:J3 for headings and G4 downward for the report. Put totals above the list or to its side. Use K2 downward for a one-column region-choice list: K is outside the four report columns G:J. Keep every output formula outside the source table.
Create a self-updating choice list
In K2, enter =SORT(UNIQUE(Orders[Region])). It returns East, North, South. Select H1 and choose Data > Data Validation. Set Allow to List and Source to =K2#.
The list source follows the helper spill. Adding a new region to the source table adds it to the choices. Data Validation supplies a convenient input; the report formula still reads H1 as an ordinary criterion cell.
Add headings and sorted rows
In G3, =Orders[#Headers] spills the four column headings across G3:J3. You can also type them. VSTACK can join headings and data in one formula where that function is available.
With North selected, this formula in G4 returns Chen 650, Ana 420, Fay 275:
=SORTBY(FILTER(Orders,Orders[Region]=H1),FILTER(Orders[Amount],Orders[Region]=H1),-1)
The data and key use the same region condition. For a report that also handles an unmatched choice, guard the sorting step:
=LET(keep,Orders[Region]=H1,IF(OR(keep),SORTBY(FILTER(Orders,keep),FILTER(Orders[Amount],keep),-1),"No orders"))
Here OR intentionally reduces the whole test array to one decision: does any order match? Only the matching case needs sorting. "No orders" appears as a single message when none match.
Show a total without blocking growth
Place =SUM(FILTER(Orders[Amount],Orders[Region]=H1,0)) above or beside the report. It returns 1345 for North and 0 for a region with no orders. A text display message and a numeric total need different empty-result behavior.
Do not put the total immediately under today's final record. Another qualifying row would need that cell and cause #SPILL!. For the same reason, avoid vertically stacking two independently growing reports in the same columns.
Prepare the display and check updates
Apply number formats and borders to the full area the list can reach. Newly occupied cells keep their own formats, so an expanding date column needs date formats ahead of time. Mark the result area so colleagues know to type in input cells or the source, not inside the spill.
Change H1 to East and check that Gus 390 appears before Dara 300 and the total becomes 690. Add a source-table row and confirm that the report and region choices include it when appropriate. To correct a displayed value, edit its source record; to change the report logic, edit the anchor.
Key Takeaways
- A live report connects an expanding source table, clear input cells, and formulas outside the table.
- Use a spill reference as the Data Validation list source for self-updating choices.
- Provide headings explicitly and handle no-match messages before sorting.
- Keep totals above or beside growing output, and format future output cells.
5Name formula steps and reuse calculations
Long formulas become easier to read when their parts have useful names. LET names values within one calculation, while LAMBDA defines a calculation that can accept different inputs. You will check named steps, simplify a report without changing its answer, test a small function, and save it for use across a workbook. The goal is a formula whose rule is easy to find, test, and change when the work changes.
5.1 Give intermediate values local names
LET gives names to values inside one formula. Its pattern is =LET(name1,value1,[name2,value2,…],calculation). Supply at least one name-value pair and finish with the calculation to return. Up to 126 pairs are allowed.
Read the pairs from left to right
=LET(x,5,x+1) assigns 5 to x and returns 6. The name exists only inside this LET formula. Typing =x+1 in another cell will not reuse it unless x is separately defined there or as a workbook name.
A later pair can use earlier names. This makes a formula read like a short sequence of steps. It cannot use a name before that name has been defined.
Work through a commission calculation
A region earns 5% of its order total when that total exceeds 1000, and 3% otherwise. With the region in H1, use:
=LET(total,SUMIFS(D2:D9,B2:B9,H1),rate,IF(total>1000,0.05,0.03),total*rate)
totaladds amounts for the chosen region.ratechecks that total and selects 0.05 or 0.03.- The final expression multiplies the two named values.
North totals 1345. Its rate is 0.05 and commission is 67.25. South totals 810, so its rate is 0.03 and commission is 24.3. Exactly 1000 would use the lower rate because the condition is strictly greater than 1000.
Without LET, the SUMIFS expression would need to appear in both the rate test and the multiplication. A named expression is calculated once and can be reused, which can reduce repeated work in larger formulas. Names also give the numbers a meaning visible to anyone reading the calculation.
Choose valid, readable names
A LET name must start with a letter and obey Excel's naming rules. It cannot be a cell reference or reference notation. Names are not case-sensitive.
tax_rateandqtr_totaldescribe values clearly.q1,vat1, andtax2026look like worksheet addresses and are invalid names. Excel's columns reach XFD, including TAX and VAT.- The single letters c and r conflict with R1C1 reference notation.
sales2026is valid because SALES is beyond the worksheet's column range.
Descriptive words with underscores avoid the risk of accidentally choosing a column-and-row address. Names are written without quotation marks; quoted text is a value, not a name reference.
Inspect a named step
To check the commission rate alone, temporarily replace the last total*rate with rate. For North, the formula then returns 0.05. End it with total to inspect the subtotal. Restore the final expression once those steps are correct.
A name can hold an entire array, not just a number. A final calculation that returns that array spills normally. The name itself does not create an extra worksheet range; only the formula's returned result is displayed.
Keep the final calculation after all pairs. =LET(x,5) leaves it out and is incomplete. If a name should be available to other cells, define a workbook name in Name Manager; LET names remain local to their formula.
Key Takeaways
- LET contains name-value pairs followed by the result calculation.
- Names are local, read left to right, and can hold single values or arrays.
- Reusing a named expression avoids repeating its calculation.
- Choose meaningful names that do not conflict with cell or reference syntax.
- Temporarily return a named step to check its value.
5.2 Rewrite a report with named steps
A LET rewrite should keep the same result while making each step easier to follow. Start with a working formula, identify repeated expressions, and decide what each useful name should mean.
Name a repeated condition
This formula sorts the North orders by amount:
=SORTBY(FILTER(A2:D9,B2:B9="North"),FILTER(D2:D9,B2:B9="North"),-1)
The region condition appears twice. Give it the name keep, then use that name in both filters:
=LET(keep,B2:B9="North",rows,FILTER(A2:D9,keep),amounts,FILTER(D2:D9,keep),SORTBY(rows,amounts,-1))
keep holds eight TRUE/FALSE results. rows holds the three matching records. amounts holds their three amounts. The final SORTBY returns Chen 650, Ana 420, Fay 275, just as before. Changing the criterion now requires one edit.
Reuse a field already in the filtered rows
The matching rows already contain Amount in column 4, so a second FILTER is unnecessary:
=LET(rows,FILTER(A2:D9,B2:B9=H1),SORTBY(rows,INDEX(rows,0,4),-1))
INDEX selects the fourth column from rows. Both data and sort key therefore come from the same array in the same order. This also removes one place where a later edit could accidentally give the key a different condition.
Handle an empty selection before processing rows
A no-match message is one text value, not four data columns. Guard the report before selecting its amount column or sorting:
=LET(keep,B2:B9=H1,IF(OR(keep),SORTBY(FILTER(A2:D9,keep),FILTER(D2:D9,keep),-1),"No orders"))
OR combines the eight keep tests into one answer. If at least one is TRUE, the report branch filters and sorts the matching rows. Otherwise the formula returns "No orders".
This use of OR is deliberate. Inside FILTER's include argument, you need one decision per source row and use arithmetic to combine conditions. Outside FILTER, this IF needs a single decision about the entire list, so OR is appropriate.
Check the rewrite in stages
- End the LET with
keepto inspect which rows qualify. - Return the filtered rows and compare names and row count with the original.
- Restore the final sort and compare the complete ordered output.
- Change H1 and test a region with matches and one without matches.
When introducing a name, replace every copy of the expression it represents. Leaving one old condition behind can make the report data and its key disagree after the named condition is changed.
Choose names such as keep, rows, amounts, and total that describe the values. In Excel for Windows, Alt+Enter in the formula bar lets you put pairs on separate lines without changing the calculation. Pair ordering still matters: a later value can depend on earlier names only.
LET is most useful for repeated expressions and calculations with several meaningful steps. A short =SUM(D2:D9) is already clear. Adding names to it would add reading work without simplifying the rule.
Key Takeaways
- Give repeated expressions useful names and replace every occurrence.
- Extract a sort key from the filtered rows to preserve alignment.
- Use OR for a whole-list existence check, while keeping row-by-row tests inside FILTER.
- Compare the rewritten output with the original and test an empty case.
5.3 Define and call a small function
LAMBDA defines a custom function using inputs called parameters. Its syntax is =LAMBDA([parameter1,parameter2,…],calculation). The last argument is the calculation to return; up to 253 parameters can be defined.
Supply inputs to get a result
=LAMBDA(x,x+1) defines a rule but does not call it. Alone in a worksheet cell, it returns #CALC!. Add inputs in parentheses immediately after the definition: =LAMBDA(x,x+1)(5) calls the rule with x set to 5 and returns 6.
A definition and a call do different jobs. The definition says what to calculate. The call supplies the actual values for that calculation. A wrong number of inputs returns #VALUE!.
Build a percent-change function
For an old value in B2 and a new value in C2, first test =(C2-B2)/B2 as an ordinary formula. With 80 changing to 100, it returns 0.25. Apply Percentage format to display 25%.
Now replace the two cell references with parameters and test the complete function:
=LAMBDA(old,new,(new-old)/old)(80,100)
The first input goes to old, and the second goes to new. The change is 20 divided by the old value 80. With inputs 60 and 45, the result is -0.25, a fall of 25%. The old value must be nonzero because it is the divisor.
Swapping the original inputs gives =LAMBDA(old,new,(new-old)/old)(100,80), which returns -0.2. A fall from 100 to 80 uses 100 as its base, so it is not the negative of a 25% increase from 80 to 100.
Use parameters that describe the inputs
Parameter names follow Excel's naming rules and cannot contain a period. Names such as old, new, and row_vals are clear. Avoid cell-like names and the reserved single letters c and r. Keep the same parameter order in the definition, test call, and any description you later save.
A function built from ordinary array arithmetic can also accept ranges. Calling the percent-change rule with B2:B5 and C2:C5 returns one change per corresponding pair and spills four results. The ranges must describe matching records.
Name steps inside the function
LET can make a LAMBDA calculation easier to read:
=LAMBDA(net,rate,LET(tax,net*rate,net+tax))(200,0.21)
The inputs are net 200 and rate 0.21. LET calculates tax as 42, then adds it to net, returning 242. tax exists inside that calculation; net and rate receive values from the call.
Apply a rule to each row
BYROW takes an array and a LAMBDA that processes each row. =BYROW(B2:D4,LAMBDA(row_vals,MAX(row_vals))) finds the maximum of each of the three rows and returns a three-row column. The parameter row_vals receives one row at a time. Return one result for each row.
LAMBDA and BYROW need Microsoft 365 or Excel 2024. Once a function passes its small worksheet tests, save its definition under a workbook name to call it without repeating the LAMBDA wrapper.
Key Takeaways
- A LAMBDA definition needs a call with inputs to calculate a worksheet result.
- Inputs are assigned to parameters in their written order.
- Test the ordinary calculation first, then test the LAMBDA with known inputs.
- Array arithmetic in a LAMBDA can spill one result per input pair.
- LET names intermediate steps; BYROW applies a LAMBDA to one row at a time.
5.4 Save a function for the workbook
A tested LAMBDA becomes easier to reuse when you save it under a meaningful name. Every formula that calls that name then uses the same definition, so a change to the rule has one home.
Save the definition without the test call
For a percent-change function, use this definition:
=LAMBDA(old,new,(new-old)/old)
In Excel for Windows, choose Formulas > Name Manager > New. On a Mac, choose Formulas > Define Name. Enter:
- Name: PCTCHANGE.
- Scope: Workbook.
- Comment: "Returns the change from old to new as a fraction of old; old must be nonzero."
- Refers to: the LAMBDA definition above.
Save the name. The comment helps identify the inputs when using Formula Autocomplete. Keep its input order consistent with the function's definition.
Do not save =LAMBDA(old,new,(new-old)/old)(80,100) as the definition. That expression calls the rule immediately with fixed inputs and returns 0.25. The reusable name needs to refer to the function itself, ready to receive new inputs.
Call it from cells and ranges
Enter =PCTCHANGE(B2,C2) to calculate the change from B2 to C2. Format the result as a percentage. The worksheet call supplies inputs; the saved definition supplies the calculation.
For four products, let the old values in B2:B5 be 80, 120, 50, and 200, and the new values in C2:C5 be 100, 126, 45, and 230. =PCTCHANGE(B2:B5,C2:C5) in D2 returns four changes:
| Old | New | Displayed change |
|---|---|---|
| 80 | 100 | 25% |
| 120 | 126 | 5% |
| 50 | 45 | -10% |
| 200 | 230 | 15% |
Each row uses its own old value as the base. The single formula spills into D2:D5. Calling PCTCHANGE with only one input or with three inputs returns #VALUE! because its definition has two parameters.
Choose names and scope carefully
A defined function name starts with a letter or underscore, has no spaces, and cannot look like a cell reference. PCT1 is a worksheet address, so use a name such as PCTCHANGE or Pct_Change. Descriptive names also make formulas easier to understand when someone opens the workbook later.
Workbook scope makes the name available on every sheet in that workbook. Sheet scope restricts it to that sheet's local naming context; an unqualified call from another sheet will not find it. Choose Workbook when the function is meant to be shared across the file.
Maintain one rule and move it deliberately
Editing the LAMBDA definition in Name Manager updates formulas that call that name. Check representative inputs after any rule change, including decreases if the function calculates change, and confirm that all callers still pass inputs in the expected order.
A named function belongs to its workbook. Another workbook needs its own definition, which you can create by copying the Refers to formula into a new name there. A named LAMBDA is useful for a meaningful calculation repeated in many places, such as percent change or commission. A one-time calculation can stay as an ordinary formula.
Key Takeaways
- Save the LAMBDA definition in Name Manager without its worksheet test call.
- Workbook scope makes an unqualified function call available across sheets in that file.
- A named LAMBDA can receive ranges and return a spill.
- Edit the saved definition to update callers, and define it separately in another workbook.
6Share formulas across Excel versions and Sheets
A workbook can open successfully while some of its formulas cannot recalculate. Before sharing a live report, check the functions the recipient’s version supports and decide whether the recipient needs editable calculations or just the results. Google Sheets adds another kind of check: it supports arrays, but its filtering, sorting, and referencing rules differ from Excel’s. Test those calculations after moving a workbook.
6.1 Check function support and older formulas
A workbook needs support for every function it uses. Opening the file is not enough: a recipient must be able to recalculate the formulas and change their inputs successfully.
Check the required function group
| Excel version | Functions used here |
|---|---|
| Microsoft 365 and Excel 2024 | FILTER, SORTBY, SEQUENCE, LET, LAMBDA, BYROW, TAKE, CHOOSECOLS, HSTACK, VSTACK. |
| Excel 2021 | FILTER, SORTBY, SEQUENCE, LET, plus SORT and UNIQUE in combined formulas. |
| Excel 2019 and earlier | No dynamic-array support or these newer functions. |
Dynamic arrays also work in Excel for the web and mobile apps. The newer LAMBDA and array-selection functions are supported in Microsoft 365, including Excel for the web. Excel 2021 cannot run a report merely because its FILTER is supported if the same formula also uses TAKE.
Understand _xlfn. and fixed legacy arrays
An unsupported function can appear with an _xlfn. prefix in an older Excel formula bar. When recalculated, the cell returns #NAME?. Deleting the prefix does not add the missing function. Saved values might be visible before recalculation, so test the workbook's behavior instead of judging support from its first display.
Older Excel represents a spilling formula as a legacy array occupying the cells saved with its result. It cannot grow or shrink there. Functions that the old version lacks still cannot calculate inside that fixed range.
Legacy CSE formulas were entered by selecting the whole output area and pressing Ctrl+Shift+Enter. Excel displays braces such as {=A2:A9*2} around them; the braces are not typed. They continue to work in dynamic Excel but keep their fixed size.
To convert a suitable legacy array in dynamic Excel, copy the formula text from its top-left cell, delete the whole legacy output range, and enter the text in the anchor with Enter. Leave room for the new spill. Deleting only part of a legacy array is not allowed.
Read the @ operator
Implicit intersection reduces an array or range to one value. Older Excel did this silently where a single value was expected. Modern Excel can show an @ to preserve that behavior.
In row 5, =@A2:A9 returns A5 only. In a row outside 2 through 9, it returns #VALUE! because no cell of that vertical range meets the formula's row. Removing the @ changes the formula to =A2:A9, which spills all eight values. Remove it only when that full output is wanted and has room.
Choose how to share
In Excel for Windows, run File > Info > Check for Issues > Check Compatibility. The Compatibility Checker identifies formulas that need attention for selected older versions. Check actual results and recalculation in the intended version too.
For recipients using Excel 2019 or earlier, share a separate results copy with Paste Special > Values if they only need the numbers. If they need editable calculations, rebuild the necessary reports with supported tools such as SUMIFS, COUNTIFS, and the Filter button. For a live dynamic workbook, confirm support for every function, including named LAMBDA definitions and helper formulas.
Key Takeaways
- Excel 2021 supports the core dynamic functions and LET, but lacks LAMBDA and the newer selection and stacking functions.
- An _xlfn. prefix signals an unsupported function; removing it does not restore calculation.
- Legacy CSE arrays have fixed output sizes.
- The @ operator returns one intersecting value and can prevent a spill.
- Check compatibility and choose live formulas, supported replacements, or shared values to suit the recipient.
6.2 Rewrite the parts that differ in Google Sheets
Google Sheets expands array results into neighboring cells too, but an Excel formula may need changes to its arguments or references. Keep the output area clear: a blocked Sheets array shows #REF! with a message that it would overwrite data.
Wrap ordinary range arithmetic
In Sheets, =ARRAYFORMULA(B2:B6*C2:C6) returns all five row-by-row products. Ordinary range arithmetic needs this wrapper to expand in the way it does automatically in dynamic Excel. Ctrl+Shift+Enter while editing can insert ARRAYFORMULA. Functions such as FILTER already process their condition ranges as arrays, so those conditions need no wrapper.
Rewrite FILTER's conditions and empty case
Sheets accepts separate conditions for AND:
=FILTER(A2:D9,B2:B9="South",D2:D9>150)
This returns Ben and Eli. Each condition has eight results matching the eight source rows. Excel's multiplication form also works in Sheets, and addition within one condition still expresses OR.
Sheets FILTER has no Excel-style if_empty argument. No matches produce #N/A. To display a message, use =IFNA(FILTER(A2:D9,B2:B9=H1),"No orders"). Appending "No orders" as another FILTER argument would make it a condition, not a fallback. IFNA handles #N/A, so investigate unexpected source errors instead of assuming every such error means no matches.
Replace SORTBY with SORT
Sheets has no SORTBY. Its SORT takes a column position or a separate one-column range, then TRUE for ascending or FALSE for descending. The separate range must have the same height as the returned data.
The Excel formula =SORTBY(A2:A9,D2:D9,-1) becomes =SORT(A2:A9,D2:D9,FALSE). It returns only names, ranked by amount, from Chen to Hana.
For a four-column filtered report, use =SORT(FILTER(A2:D9,B2:B9=H1),4,FALSE). FILTER returns the chosen region, then SORT uses column 4 within that result. Guard the sorting branch when there are no matches; a one-cell message has no fourth column.
Replace spill references deliberately
Sheets has no # spill operator. An open-ended reference such as G2:J runs to the bottom of the sheet, including cells beyond the current output. It is not an exact equivalent of G2# and can include unrelated entries or blank rows. Keep that area dedicated to the report, or place the producing formula directly inside its consumer so only its result is passed along.
Recreate reusable functions
SEQUENCE, LET, and LAMBDA exist in Sheets with the same basic argument order. Reusable named functions are created under Data > Named functions. For PCTCHANGE, enter old and new as argument placeholders, then set the formula definition to =(new-old)/old. Do not wrap that definition in LAMBDA: the named-function interface supplies the placeholders separately.
After conversion, test a normal result, a changed input, and no matches. Inspect each formula that used SORTBY, a # reference, or FILTER's third argument. Confirm that totals and row counts still describe data rows, especially where an open-ended range has replaced an exact spill reference.
Key Takeaways
- Use ARRAYFORMULA for ordinary range arithmetic in Google Sheets.
- Sheets FILTER accepts separate AND conditions and uses IFNA for a no-match message.
- Sheets SORT accepts a key range or column position and a TRUE/FALSE direction.
- Sheets has no # operator; open-ended ranges include more than the current spill.
- Recreate named functions with separate placeholders and a formula definition.
Dynamic Arrays examples
1Follow a spill from formula to result
12 steps
- 1IntroductionGive a formula room to work
A quantity list has five rows, and you need five line totals. In dynamic Excel, one formula can calculate all five and place them in neighboring cells. That overflow is a spill, and it saves you from copying formulas down. You will predict that output, connect another calculation to its changing size with the # operator, and clear an obstruction when the values cannot appear. Use Microsoft 365, Excel 2021, or Excel 2024 and a clear output area for these examples.
- 2ExplanationFind the anchor
The anchor is the cell where you enter the formula. Its result can spill into a rectangular block below or to the right. Click any result cell to see the spill boundary; only the anchor owns an editable formula. A grayed-out formula in another spill cell points back to that shared calculation, so make changes at the top-left cell.
- 3ExampleCalculate five line totals
With quantities in B2:B6 and prices in C2:C6, enter
=B2:B6*C2:C6in D2. Excel multiplies B2 by C2, then B3 by C3, through row 6. The five results fill D2:D6. A row containing quantity 4 and price 2.5 contributes 10. Enter the formula once: a copied formula in D3 would occupy part of the first formula’s intended output. - 4Key InsightThe inputs set the shape
Equal-sized ranges pair values by position. A single value can be reused across a whole range, as in
=B2:B6*2. A three-row column multiplied by a four-column row makes a 3-by-4 grid because each input expands across the other dimension. Check heights and widths before assuming that two array calculations will produce a single column. - 5ChallengePredict a smaller grid
A clear worksheet area contains
=SEQUENCE(2)*SEQUENCE(1,3). What shape and values does it return?---reveal---
It returns two rows and three columns. The first row is 1, 2, 3; the second is 2, 4, 6. The column 1, 2 is multiplied across the row 1, 2, 3. It produces six cells in a grid, not six values stacked in one column.
- 6ExampleConnect a total to the list
Enter
=SEQUENCE(10)in A2 and=SUM(A2#)in a separate clear cell. The total is 55. The # operator means the full current spill beginning at A2. Change the sequence to 20 rows: the same SUM now returns 210. A fixed reference to A2:A11 would still sum only the first ten cells and miss the added values. - 7ExplanationSelect one report column
If G2 spills a three-row, four-column report,
=ROWS(G2#)returns 3 and=COLUMNS(G2#)returns 4. To use its amount column alone, write=INDEX(G2#,0,4). Row 0 requests the entire fourth column.=SUM(INDEX(G2#,0,4))totals those amounts without adding numbers from other report columns. - 8ChallengeRepair a spill reference
M4 anchors a changing report, and its second column contains hours. Someone enters
=SUM(INDEX(M5#,0,2)). What needs correcting?---reveal---
Use
=SUM(INDEX(M4#,0,2)). M4 is the anchor, so M4# identifies the whole result. M5# returns #REF! even if M5 lies inside that result. INDEX then selects the hours column by its position within the spill. - 9ExampleRead the obstruction message
A four-column filter in G2 needs G2:J4. A note in J3 prevents the entire result from appearing. Select G2, open its error indicator, and choose Select Obstructing Cells to locate the content. Move or clear the note and the result spills. A typed space or a formula returning
""also counts as content; a cell’s blank appearance can be misleading. - 10TipCheck more than occupied cells
Keep spilling output formulas outside Excel tables and away from merged cells. A result must also fit within the worksheet edges. If the error says its size is indeterminate, check for a random row count that changes between calculation passes. Clearing cells will not stabilize a formula such as
=SEQUENCE(RANDBETWEEN(1,10))whose size keeps changing. - 11ChallengePlan for the sixth row
A five-row spill begins at H3. Its total is typed in H8. The source changes so the list needs six rows. What happens, and where should the total go?
---reveal---
The sixth result needs H8, so the typed total blocks the result with #SPILL!. Move the total above the anchor or into another column, and reference the anchor with # if the total should follow the list. Keep the future growth area clear too.
- 12RecapCheck ownership, reference, and space
For a spilling calculation, locate the anchor, predict the result’s dimensions, and leave that rectangle free to grow. Connect dependent calculations with the anchor’s # reference, selecting a single column when needed. If output fails, read the error reason: #SPILL! points to placement or size trouble, while FILTER’s no-match #CALC! requires a different selection or an empty-result value.
2Build a selection one condition at a time
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionChoose what belongs in the list
- 2ExplanationSeparate output from the test
- 3ExampleReturn the North orders
- 4ExampleMove the choice into H1
- 5ChallengeChoose an output field
- 6ExplanationRequire both tests
- 7ExampleAccept either product
- 8ChallengeGroup alternatives before a requirement
- 9TipInclude the whole final day
- 10ExplanationTurn searches into keep tests
- 11ChallengeLet an empty choice show everything
- 12RecapKeep one decision per record
3Order records and create useful series
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionChoose an order or create a series
- 2ExampleRank by a field you do not display
- 3ExplanationUse a second priority for ties
- 4ChallengeRead a two-key order
- 5ConnectionTurn a custom order into ranks
- 6ExplanationSet SEQUENCE’s four inputs
- 7ExampleChange the starting point and spacing
- 8ChallengeLocate a value in a grid
- 9ExampleCreate weekly dates
- 10Key InsightLet another result control length
- 11ChallengeKeep ranks beside a ranked list
- 12RecapKeep keys aligned and series shaped
4Assemble a growing region report
15 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionBuild the report in separate decisions
- 2ExampleCheck the filtered arrays first
- 3ExamplePass both arrays to SORTBY
- 4ChallengeDiagnose a mismatched key
- 5ConnectionReturn one total instead of a list
- 6ExampleKeep the top three after ranking
- 7ExampleKeep names and amounts
- 8ChallengePredict a bottom selection
- 9TipKnow the alternatives and tie limits
- 10ConnectionJoin useful pieces
- 11ExampleConnect an expanding source and choices
- 12ExamplePlace headings and a guarded result
- 13ChallengeChoose a total’s home
- 14ChallengeCheck an empty report count
- 15RecapTest the report as a connected whole
5Turn a long formula into a reusable rule
17 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMake the calculation readable
- 2ExampleRead the last argument as the result
- 3ExampleSeparate a total and a rate
- 4ChallengeInspect the decision boundary
- 5TipChoose names Excel can read
- 6ExampleName a repeated selection
- 7Key InsightTake the key from the filtered records
- 8ChallengeDecide when OR belongs
- 9ExampleTest an ordinary change calculation
- 10ExampleReplace cells with parameters and call
- 11ChallengeCheck a decrease and swapped inputs
- 12ConnectionApply a rule across rows
- 13ExampleSave the callable definition
- 14ExampleUse one rule for four records
- 15ChallengeRepair a saved function
- 16ChallengeKeep local steps and shared rules distinct
- 17RecapTest before and after reuse
6Move a live report to another environment
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionCheck calculation, not just file opening
- 2ExplanationCheck every function in the chain
- 3ExampleRead unsupported and fixed arrays
- 4ExampleDecide whether @ should stay
- 5ChallengeChoose a sharing method
- 6ExplanationKeep Sheets output clear too
- 7ExampleRewrite conditions and the no-match case
- 8ExampleReplace SORTBY with Sheets SORT
- 9ChallengeTranslate a ranking formula
- 10TipReplace references and saved functions
- 11ChallengeProtect a total during conversion
- 12RecapTest the intended recipient’s work
Dynamic Arrays practice questions
Set 1: Read and build dynamic results10 Practice Questions
Question 1 of 10
=LET(base,240,rate,0.08,base*rate) return?Show answerHide answer
Question 2 of 10
=SEQUENCE(4) is entered in F3. Which cells contain its result?Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
=SEQUENCE(1,4,6,3) return?Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Choose conditions and reusable rules10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
=SEQUENCE(3)*SEQUENCE(1,2) is entered in a clear area. What shape does the result have?Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
(priority="Urgent")+(owner="Jo") scores that row as 2. How many copies of that source row does this make FILTER return?Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
=TAKE(SORTBY(A2:C20,C2:C20,-1),5). Only three records remain after the source is shortened and the references are adjusted to those three rows. What does TAKE return?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
=LAMBDA(qty,qty*4)(7) return?Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
=LAMBDA(qty,price,qty*price)(6,8). What should Refers to contain when saving the reusable function LINEVALUE?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
=FILTER(A2:C9,C2:C9="Ready") display "No rows" when there are no matches?Show answerHide answer
Save this lesson to see this answer.
Set 3: Trace results and diagnose failures10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
=FILTER(A2:D13,C2:C13=J1). What change returns only the values from column A while keeping the same records?Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
=SEQUENCE(2,3,4,2)?Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
tax_rate a valid LET name while tax2027 is not?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
keep as a selected department test. One FILTER uses keep, but the sort-key FILTER still compares the source with "Design". The chosen department changes to "Support", which has the same number of rows. What can happen?Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
=LAMBDA(old,new,(new-old)/old)(150,120) return before percentage formatting?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
=@B3:B8 return when entered in row 6?Show answerHide answer
Save this lesson to see this answer.
Set 4: Design reports that survive changes10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
=LET(units,12,units+3) return?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
_xlfn.FILTER and #NAME? after recalculation. What restores a live editable result for that recipient?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 5: Repair and adapt complete calculations10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
INDEX(H4#,0,4). The anchor is changed to return only Name, Hours, but the total formula is left unchanged. What repair keeps the total tied to the revised report?Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
=ROWS(G4#). For a choice with no matches, G4 shows "No records" and the count shows 1. What should change?Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
=BYROW(B2:D4,LAMBDA(row_vals,MAX(row_vals))) return?Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
=LAMBDA(before,after,(after-before)/before) works on its defining sheet. An unqualified call on another sheet gives #NAME?. The inputs are valid and the name was created with sheet scope. What fixes reuse across sheets while preserving the rule?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Aggregate
Anchor
Array expansion
ARRAYFORMULA
=ARRAYFORMULA(B2:B6*C2:C6) for five row-by-row products instead of a single result.B
BYROW
C
CHOOSECOLS
Compatibility Checker
Criterion
Custom sort order
D
Data Validation list
=K2#, the spill of a region list, so newly added regions become available as report choices.Date serial
Dynamic array formula
=B2:B6*C2:C6 returns five line totals from one entry in the output’s top cell.E
Exclusive upper boundary
F
FILTER
Final calculation
Fixed reference
Formula rewrite
Function call
(80,100) after the percent-change LAMBDA tests the rule with old 80 and new 100.G
Growth area
H
Helper spill
HSTACK
I
if_empty
IFNA
Implicit intersection
=@A2:A9 returns A5 while removing @ requests the whole eight-cell range as a spill.Include array
Indeterminate size
INDEX column selection
INDEX(G2#,0,4) supplies the amount column of a four-column report to SUM.Intermediate result
L
LAMBDA
Legacy CSE array
LET
Live report
Local scope
M
Membership test
Merged cells
N
Name Manager
Name-value pair
total,SUMIFS(amounts,regions,H1) defines total before a later rate expression refers to it.Named LAMBDA
=PCTCHANGE(B2,C2) applies the stored percent-change rule to those cells.Nested formula
O
Obstructing cell
Open-ended range
P
Parameter
LAMBDA(old,new,…), the first supplied input goes to old and the second goes to new.Partial-text match
R
Range-only argument
Refers to
Row alignment
Row-by-row AND
Row-by-row fill
Row-by-row OR
S
Secondary key
SEQUENCE
Sheets named function
=(new-old)/old as the definition.Sort key
SORTBY
Spill range
Spill range operator
G2# follows the report’s changing row count without editing a fixed ending cell.Spilling
=SEQUENCE(4) in H3 spills four consecutive numbers down the worksheet through H6.Step
Structured reference
Orders[Amount] includes new amounts when more order rows are added to the table.T
TAKE
Top-N cutoff
V
VSTACK
W
Whole-list test
Workbook scope
#
_xlfn. prefix
#SPILL! error
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.