How to Use MAP and LAMBDA to Compare Adjacent Values in Spilled Arrays
Question details
The user needs to compare adjacent values within a spilled array but gets blank results when using a combination of MAP, INDIRECT, ADDRESS, and OFFSET.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Classifying or comparing data across adjacent cells in a dynamic array formula.
- Observed behavior
- The formula returns blank results due to improper use of volatile array-referencing functions inside a MAP/LAMBDA construct.
Ensure your spreadsheet software is updated to a version that supports dynamic array functions like MAP, LAMBDA, LET, and DROP. Clear any adjacent cells to avoid #SPILL! errors when testing your new formula.
Replace Volatile Functions with DROP and MAP
Direct array manipulation using DROP is cleaner, faster, and avoids the blank results caused by INDIRECT and OFFSET in dynamic arrays.
Volatile functions like INDIRECT and OFFSET often struggle to resolve correctly inside array iterators like MAP, leading to blank or erroneous outputs. By using DROP to shift the array, you can pass the original and shifted arrays simultaneously into MAP.
This method avoids referencing physical cell addresses and instead manipulates the arrays directly in memory, which is the best practice for modern dynamic array formulas.
Start your formula using the LET function to define your spilled array. For example: =LET(tbl, A1#,...)
Drop the last column (or row) of your base array so you have an array representing the 'current' values. Use the formula DROP(tbl,, -1).
Drop the first column (or row) of your base array to represent the 'adjacent' or 'next' values. Use the formula DROP(tbl,, 1).
Pass both arrays into MAP and use LAMBDA to define your comparison logic. Your final formula structure will look like: MAP(DROP(tbl,, -1), DROP(tbl,, 1), LAMBDA(current, next, [your logic here])).

Easily Handle Dynamic Arrays with WPS Spreadsheets
WPS Spreadsheets offers robust support for advanced dynamic array functions like MAP, LAMBDA, LET, and DROP. You can effortlessly build and calculate complex array formulas to process data faster and more efficiently.
- 1. Open your workbook: Launch WPS Spreadsheets and open the file containing your data.
- 2. Select the target cell: Click the cell where you want your new dynamic array to begin spilling.
- 3. Enter the optimized formula: Type your optimized formula using LET, MAP, and DROP to handle the adjacent values.
- 4. Calculate and spill: Press Enter. WPS Spreadsheets will automatically calculate the results and spill them into the adjacent cells perfectly.

Frequently Asked Questions
Why do INDIRECT or OFFSET return blank inside MAP?
INDIRECT and OFFSET are volatile functions that expect physical range references. When MAP iterates over an array, it passes evaluated values rather than cell references, causing INDIRECT and OFFSET to fail or return blanks.
What does the DROP function do in this formula?
The DROP function removes a specified number of rows or columns from an array. By dropping the first item in one array and the last item in another, you effectively offset the data, aligning 'current' and 'next' values for parallel comparison within MAP.
Can I use this method for vertical arrays (rows) instead of columns?
Yes. To compare adjacent rows instead of columns, adjust the DROP arguments to target rows rather than columns. For example, use DROP(tbl, -1) and DROP(tbl, 1) instead of using the column parameter.
How do I handle errors if the arrays are different sizes?
When using MAP with multiple arrays, all arrays must be exactly the same size. Using DROP on the identical base array and ensuring you drop the exact same number of elements from opposite ends guarantees matching dimensions, preventing size mismatch errors.




