How to Build a Dynamic Array Formula for Matching Data in Excel
Question details
The user needs to build a dynamic spilled-array calculation that matches entities and drivers to various non-contiguous data blocks, and then multiplies the matching results by growth factors.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Building complex financial or data models where source sections are separated and require dynamic lookups and array multiplication.
- Observed behavior
- The goal is to successfully return a spilled array of calculated values by matching combined lookup keys across sparse or separated data blocks without manually adjusting ranges.
Ensure you are using a modern version of your spreadsheet software (like Microsoft 365 or the latest WPS Office) that supports Dynamic Arrays and advanced functions like LET, XMATCH, and VSTACK.
Use LET, VSTACK, and XMATCH for Separated Data Blocks
This method is best when your source data sections are separated by other data or blank rows. VSTACK helps combine these separated areas into one continuous virtual array.
By utilizing the LET function, you can define variables for your lookup values, the stacked search array, and the return array. This makes the formula easier to read and prevents Excel from calculating the same array multiple times.
Combine your entities and drivers into a single unique lookup string using the ampersand, for example: B15:B21&"|"&F15:F21.
Use the VSTACK function to combine your non-contiguous lookup ranges into one array. For example: VSTACK(B4&"|"&F5:F6, B7&"|"&F8:F9, B10&"|"&F11:F12).
Similarly, use VSTACK to combine the ranges containing the data you want to retrieve: VSTACK(I5:M6, I8:M9, I11:M12).
Use XMATCH to find the row position of your lookup keys inside the stacked lookup array. Pass this position into the INDEX function along with SEQUENCE(,COLUMNS(return_arr)) to return the full row. Finally, multiply this result by your values and factor ranges.

Use SCAN and LAMBDA to Handle Sparse Entity Names
Use this approach when entity names are only listed once at the top of a data block and need to be virtually "filled down" to match against drivers.
Create Dynamic Array Formulas Easily with WPS Spreadsheet
WPS Office fully supports advanced dynamic array functions like LET, XMATCH, and VSTACK. It provides a seamless environment to build complex data models and financial calculations without the need for expensive subscriptions.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your data blocks.
- 2. Select the target cell: Click the top-left cell where you want your dynamic array formula results to begin.
- 3. Enter the formula: Type your `=LET(...)` formula and press Enter. The results will automatically calculate and spill into the adjacent cells, matching Microsoft Excel's behavior exactly.

Frequently Asked Questions
What is a spilled array formula?
A spilled array formula is a calculation that returns multiple values simultaneously. Instead of having to copy the formula down a column or across a row, you write it in a single cell, and the results automatically 'spill' into the neighboring empty cells.
Why use the LET function for complex formulas?
The LET function allows you to assign names to calculation results or specific ranges within a formula. This significantly improves readability and increases performance because the software doesn't have to recalculate the same array multiple times.
How does VSTACK help with non-contiguous data?
VSTACK takes multiple separate arrays or ranges and appends them vertically into a single virtual array. It is highly effective for combining data blocks separated by blank rows or subtotals so that they can be easily searched using a single XMATCH function.
What does the SCAN function do in Excel arrays?
SCAN applies a custom LAMBDA function to each value in an array and returns an array of intermediate values. In this scenario, it is used to virtually 'fill down' empty cells by checking if a cell is blank and, if so, returning the value of the cell above it.




