Function Problems

How to Build a Dynamic Array Formula for Matching Data in Excel

Emma BrownEmma Brown Nov 10, 2026 869 views

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.

How to Build an Excel Dynamic Array Formula for Matching Drivers and Spilled Data
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.
Before you start

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.

Solution 1Recommended

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.

1
Define the lookup keys

Combine your entities and drivers into a single unique lookup string using the ampersand, for example: B15:B21&"|"&F15:F21.

2
Stack the separated ranges

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).

3
Stack the return arrays

Similarly, use VSTACK to combine the ranges containing the data you want to retrieve: VSTACK(I5:M6, I8:M9, I11:M12).

4
Combine with XMATCH and INDEX

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 LET, VSTACK, and XMATCH for Separated Data Blocks
Formula Example: =LET(lookup_val, B15:B21&"|"&F15:F21, lookup_arr, VSTACK(B4&"|"&F5:F6, B7&"|"&F8:F9), return_arr, VSTACK(I5:M6, I8:M9), factor, E15:E21, values, I15:M21, IFNA(INDEX(return_arr, XMATCH(lookup_val, lookup_arr), SEQUENCE(,COLUMNS(return_arr))), 1)*values*factor)
Powerful Spreadsheet Formulas

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. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your data blocks.
  2. 2. Select the target cell: Click the top-left cell where you want your dynamic array formula results to begin.
  3. 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.
Full compatibility with Microsoft Excel functions, including modern Dynamic Arrays.Fast processing of complex spilled-array calculations and large datasets.Free, lightweight, and features a familiar user interface for a smooth transition.
microsoft office alternative - wps office

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.