Fix LAMBDA and MAP Errors in Excel LET Formulas
Question details
The user needs to fix an error caused by using MAP inside BYROW within a LET formula to generate a dynamic matrix of product attributes.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Converting repeated product numbers and attributes into a structured two-dimensional matrix using dynamic array functions.
- Observed behavior
- The formula returns #CALC! or #N/A errors because Excel currently does not support returning an array of arrays from MAP inside BYROW.
Ensure you are using a version of Excel that supports dynamic array functions like LET, LAMBDA, MAP, and BYROW, such as Excel 365 or Excel 2021. Check your data range to ensure there are no empty cells that might interfere with the UNIQUE function.
Replace Nested MAP and BYROW with XLOOKUP
Excel cannot output an array of arrays from a nested MAP and BYROW function. The most efficient workaround is building a two-dimensional lookup array using XLOOKUP.
Nesting iterative functions often causes Excel to attempt generating an array of arrays, triggering a #CALC! error. By concatenating the lookup values, we can flatten the logic and use XLOOKUP to handle the matrix generation smoothly.
Start your LET function and select your data ranges for product numbers (e.g., A2:A147), attribute names (e.g., F2:F147), and attribute values (e.g., G2:G147).
Combine the product numbers and attribute names using an ampersand and a delimiter like a pipe character. For example: lookup_array, p_num&"|"&attrib_name.
Generate the matrix framework by extracting unique rows and columns. Use UNIQUE(p_num) for the row headers and TOROW(UNIQUE(attrib_name)) for the column headers.
Write the XLOOKUP step to bypass MAP: results, XLOOKUP(nums&"|"&names, lookup_array, attrib_value, "").
Wrap everything together using HSTACK and VSTACK to join your row headers, column headers, and the new results matrix into a single output: HSTACK(VSTACK("P_NUM",nums),VSTACK(names,results)).

Use MAP with Concatenated Variables Instead of BYROW
If you still prefer to use MAP to iterate over your arrays, pass a single joined array to MAP rather than nesting it inside BYROW.
Use REDUCE and VSTACK for Matrix Generation
Another approach to generate a matrix from a list of items and attributes without triggering nested array limitations is using the REDUCE function.
Build Advanced Dynamic Array Formulas in WPS Spreadsheet
WPS Spreadsheet fully supports modern dynamic array functions like LET, LAMBDA, XLOOKUP, and REDUCE. You can build complex, multi-dimensional reports and troubleshoot array formulas without performance issues.
- 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your product and attribute lists.
- 2. Select the destination cell: Click on the cell where you want the dynamic matrix to start spilling its data.
- 3. Type your formula: Enter your =LET(...) formula utilizing XLOOKUP or REDUCE to bypass nested array limitations.
- 4. Press Enter to execute: Hit Enter to instantly spill the evaluated matrix results across the required rows and columns.

Frequently Asked Questions
Why does my LET formula return a #CALC! error in Excel?
The #CALC! error usually occurs when an Excel formula attempts an operation that isn't supported, such as returning an array of arrays. This frequently happens when trying to nest a MAP function inside a BYROW function.
Can Excel return arrays within arrays using LAMBDA?
Currently, Excel does not support 'arrays of arrays' or multi-dimensional nested arrays natively through iterative functions like MAP or BYROW. You must flatten the lookup variables or use XLOOKUP on concatenated strings to output a single two-dimensional array.
What does the DROP function do when used with REDUCE?
When building a data matrix with REDUCE and VSTACK, you typically start the formula with a blank accumulator string (""). The DROP function is used at the end to target and remove this initial blank row from your final output matrix.




